Multi - LOD Models (Level of Detail)

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

  1. Shinobi1507

    Shinobi1507

    New Member

    Joined:
    Sep 8, 2010
    Messages:
    125
    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

    Member

    Joined:
    Aug 21, 2009
    Messages:
    592
    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

    New Member

    Joined:
    Sep 8, 2010
    Messages:
    125
    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

    Member

    Joined:
    Aug 21, 2009
    Messages:
    592
  5. Shinobi1507

    Shinobi1507

    New Member

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