1. Unity 5.6 is now released.
    Dismiss Notice
  2. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  3. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  6. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice

Multi - LOD Models (Level of Detail)

Discussion in 'Scripting' started by Shinobi1507, Dec 20, 2010.

  1. Shinobi1507

    Shinobi1507

    Joined:
    Sep 8, 2010
    Posts:
    146
    I'm starting this post so that anyone else wondering this may find it easily. As I searched for about 20 min with no luck on how this is done in unity. and obviously I've seen the Turn mesh rendering on/off at certain distances, but I want to know what the most efficient way of doing that.

    I have 2 - 3 models per object. I'm no coder so making them blend together is not exactly something I can just pull from nowhere.

    here's the model breakdown

    Full Detail (Usually one or two Textures)
    Medium Detail (Usually one Texture, and only used on a few higher poly models (Like a few buildings))
    Billboard (Yes i made a billboard for most objects, one tex for them as well)

    here's how they are structured

    Main object IS the high poly
    then has sub-objects for the lower variants.

    please tell me the most efficient way to make them change, and the best way to calculate a players distance from them.
     
  2. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    640
    Using Vector3.Distance should be efficient enough.... but if it's not you can use OcclusionArea's to determine which objects are visible or
    check renderer.isVisible to determine if the object is actually visible first.
     
  3. Shinobi1507

    Shinobi1507

    Joined:
    Sep 8, 2010
    Posts:
    146
    I forgot to mention I'm using Unity Basic. So if that helps, Also an example please? here's how I thought to handle it.

    Make 2 Scripts and attach them to the player.

    The first script would be to handle large structures with 3 LODs and with a higher distance.
    and it would find them using a Tag called LODHigh

    And the second, would handle ones with only 2 LODs for smaller objects.
    and they would be defined using a Tag LODLow

    I'm new to java and Unity, which is why I purposely chose a project that would require very little code. So an example of what I described would be much appreciated :D. or an alternative :D.
     
    Last edited: Dec 21, 2010
  4. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    640
  5. Shinobi1507

    Shinobi1507

    Joined:
    Sep 8, 2010
    Posts:
    146
    oh wow you replied with what i needed WHILE I was editing my post. Thanks :D