Home Technical Talk

Level of Detail - what methods to use

polycounter lvl 14
Offline / Send Message
AlexLegg polycounter lvl 14
I'm wondering what methods people use for Level of Detail, and how they go about it for games.

Information seems really scarce on this subject, but maybe that's because it is straight forward!


I come form a flight sim background, and we have two methods:

Replacment:

where the whole model is replaced each time for a higher resolution version, up to three iterations in a hi res case.


Addative

where the core shape of the model stays in range, but as you get closer, increasingly more bits of detail fade in.


Is this the same for games?

And how does this effect low poly modelling and texturing?

Replies

  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    Basically it´s one model with many LOD´s ,LOD 0 would be the highest resolution,LOD 1 the second highest and so on.
    Depending on the view distance you pick the most appropriate.Things next to you will be in high res and things far away are low res.

    So it´s more like the Addative approach you described.

    Most engines can do that on the fly(if the model has different lod´s exported)

    The same goes for textures as well.

    Basically it´s the same as in your flight sims.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Thanks SpeCter.
    SpeCter wrote: »
    Most engines can do that on the fly(if the model has different lod´s exported)

    I always thought the LODs were set up in the the engine, but from what you said, it sounds like they can be set up (at least partially) in the modelling ap.

    Is this correct? if so how would I go about this (I use Max)
  • Eric Chadwick
    Options
    Offline / Send Message
    Max has a utility built-in for viewing the LODs as you edit them, switching the meshes as you move the camera in/out. There are also some scripts on scriptspot that do a better job, IIRC.

    The basic methodology is to start with the highest-res mesh, and remove every other edge loop, then fix up stretched UVs. You'll need to keep the edges that are along UV seams, for the most part.

    You may also want to balloon the lower LODs so their volume matches the original more closely.

    Some more info
    http://wiki.polycount.com/LevelOfDetail
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    Some exporters for different engines can automatically generate LOD´s. The exporter for Ogre3D can do that.You can also let Ogre generate them.

    Depending on what you do, you should do them by hand.But in most cases you can get of with automatic methods.

    Neox once said that the Atangeo Balancer does a rather good job at doing LOD´s while maintaining normals and form.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Thanks Guys.

    Eric, somehow I missed both of those threads when I was searching!!

    So...

    To make a lower LOD, just remove edge loops and keep the UVs lined up as best as possible. Removing even more loops for even lower LODs. Or maybe use a poly reducing bit of software (particularly for organics) to make them.

    In most cases you are using the same texture, so no action required here. On very low LODs you can remove all but the colour map.

    You can use the 3DS max Level of Detail in the Utilities panel to test your LODs out.



    So how do I get the LODs out of Max?


    Do I just export them out as normal (a separate model for each LOD)and set the LODs (ranges, and textures etc)up in the engine?

    Or do they have to be exported out in some special way? Maybe a format that exports them out in one go (instead of separate models), that the engine then reads as the LODs are set up and ready to go automatically? - I assume this isn't correct, but I need to ask!
  • Eric Chadwick
    Options
    Offline / Send Message
    Totally depends on the game engine you're working with. Some store all the LODs in one exported file, using naming conventions for the models or some other tagging method (like max's Custom Attributes). Others store each LOD as a separate exported file.

    Something to note... the fading/morphing kind of LOD switching method is prettier but also more expensive than the "popping" one, because the vertices need to store connectivity info so their shapes can be blended to one another (increasing the memory cost), and the fading in/out requires extra rendering time too (possibly decreasing framerate).

    It kind of looks bad on terrain though, since things kind of melt up/down. I remember Battlefield 2 had this, really evident when you fly a jet around.
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    The popping with terrain can be reduced.
    The problem main in battlefield 2 was that you already had a great distance and that you where flying relatively fast which made it obvious.

    For games where you walk on the ground with moderate speed, you can get away with morphing without obvious popping.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    I use 3DS max and UDK, what would be the best way to go about setting up the LODs, in Max or in UDK?

    And if its best to do it in Max, how do I do that? Is it a case of using the LOD utility and exporting to the FBX 2011 format?

    Or is there a better way?
  • Eric Chadwick
    Options
    Offline / Send Message
    Best would be in the engine itself. I don't use UDK enough to know, but should be some docs on it on their site. LOD-switching in Max is merely a preview to help you create the models, but it won't match the engine very well.
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    You can use the LOD Utility and fbx, but i think i remember that you need to reverse the lod order otherwise you get the opposite effect.
    (I´m also not sure if that works with non static meshes)
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    The most reliable way to do this in udk is to export separate files for each LOD and then import them using the "import LOD" menu. I'm not sure if there's any other way for skeletal meshes actually.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Thanks guys, this is really useful info.

    So then I guess its just a matter of how complicated the model is and how its been built, as to whether you replace the whole model in an LOD or you replace/remove individual parts.

    Is this correct?
  • Eric Chadwick
    Options
    Offline / Send Message
    Hmm, it's not really about how "complicated" the model is, it's simply about how to render something faster when you can drop details to do so. So if a model renders slowly (tons of vertices, tons of shader instructions, tons of alpha blending, tons of bones, etc.) and the camera can move away from it, then it is generally a good candidate for LOD.

    LOD switching is often done using distance, but there are other metircs too, like how fast the camera is moving (if you're racing in a car, most of the trees can be very simple LODs because you can't tell they're simpler), how fast the object itself is moving, etc.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    So if a model renders slowly (tons of vertices, tons of shader instructions, tons of alpha blending, tons of bones, etc.) and the camera can move away from it, then it is generally a good candidate for LOD.

    In flight sim world, we pretty much put everything on LODs. In fact we LOD the Hell out of stuff; a building may have 3 LODs, but then the chimney and windows etc might also have their own LODs too!

    So reading between the lines here, does this mean that only some things will be LOD'd? As mentioned above for instance, a particulary heavy object?

    But something simpler, like a prop or something will not be LOD'd?


    And following on from this train of thought...

    If not everything has an LOD, how are objects controlled/removed that can no longer be seen? Is there a top level control that removes these objects in the engine?
  • warby
    Options
    Offline / Send Message
    warby polycounter lvl 18
    you should first make sure you game is actually transform bound or your lods will do nothing but waste memory and man hours !

    it more likely that your game is fill rate bound or has too much over head from too many drawcalls !

    profile your game first before jumping to conclusion on how to optimize it !



    unless of course this is for an art test and they specifically asked for lods in that case disregard me ^^
  • Eric Chadwick
    Options
    Offline / Send Message
    AlexLegg wrote: »
    If not everything has an LOD, how are objects controlled/removed that can no longer be seen? Is there a top level control that removes these objects in the engine?
    You know about LODs and have worked on flight sims, but don't know about culling? Maybe I'm misunderstanding the question. Usually meshes are simply culled (not rendered) when they reach a certain distance, and/or they're a certain small scale onscreen.

    warby's right though, profile your game before spending time on it. LODs are mostly about saving transform cost. They can also reduce fillrate though, like if you swap in an LOD with a simpler shader and fewer draw calls, but since the model is usually small on the screen when it gets swapped (and since it incurs additional drawcalls simply to be rendered in the first place!), I think this doesn't really give you much bang for the buck.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    I better explain, that the reason I ask is because I am building my portfolio up and increasing my knowledge. This is something I am curious about, but do not have a real need to know at the moment!

    Well the way our sims work is to use LODs for everything within the airport, the only thing that is ever culled is the airport as a whole.

    So taking things down to a basic, non technical level then, it seems that LODs are not something I necessarily need to be concerned about. They seem to be for certain circumstances (hi poly and or textures/shaders etc) as using LODs has it draw backs too.

    In a lot of cases the objects are just culled at a distance or size by the engine.

    I am making assumptions here, but is this more or less correct?
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    Take a look at an article from Eric´s website:
    http://www.ericchadwick.com/examples/provost/byf1.html

    This will clear up why and when lod´s should be used.
    This is information you should probably always keep in mind.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Thanks SpeCter, I remember reading that quite some time ago. Time for a re-read I think!
  • Eric Chadwick
    Options
    Offline / Send Message
    Just to be clear, I didn't write those articles, I'm just hosting them.
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    Oh sorry, didn´t know that, thanks for clarifing :)
Sign In or Register to comment.