Brand new Lod Generator

Home Forum Development Engine Development Discussion Brand new Lod Generator

This topic contains 51 replies, has 12 voices, and was last updated by  pspeed 6 days, 14 hours ago.

Viewing 15 posts - 1 through 15 (of 52 total)
  • Author
    Posts
  • #218691
    +17

    nehon
    1851p
    Keymaster

    I’ve been playing around with Level of Detail lately.

    As you may know (or not), JME 3 meshes supports lods as long as they are generated. There is also a LodControl that allows you switch the lod according to the distance to the camera.
    In JME lods are implemented as several index buffers that provides different ways of connecting vertices in a mesh.
    The only way until now to generate lods on an arbitrary model was to import it in the engine through the Ogre pipeline and use the advanced conversion to j3o to generate the lods.
    This process uses Ogre’s command line tool in the background.

    I wanted to allow users to generate lods from the SDK whatever pipeline they chose. So I went and look at ogre’s code.
    I stumbled on this interesting thread http://www.ogre3d.org/forums/viewtopic.php?f=11&t=74798#p476220 where Peter Szücs a GSOC 2012 student describe how he enhanced Ogre LOD generation toward quality and performance…and provides an MIT licenced C++ code :D.

    So I went and “translated” this to Java. I’m pretty happy with the result.
    Here is Jaime with around 60% decimation. the left one is generated with JME and the “new” algorithm the right one is generated with ogre command line tool
    http://i.imgur.com/OYr925w.png
    http://i.imgur.com/CWnzYwL.png
    Ok…they both have a tooth problem, but the left one doesn’t have bat wings and the texture is not distorted along the seams.
    Note that the original model has 5108 triangles.
    I don’t even know if this algorithm has been merged to Orge 1.9 version.

    So enjoy, you now have a LodGenerator class to generate lods for any model. For now it’s only a utility class in the engine, a SDK tool will come later.
    usage is

    TriangleReductionMethod is the way to consider triangle decimation. Proportional is a percentage, Constant is an arbitrary number of triangle, Collapse_Cost is base on the aesthetic cost of collapsing a triangle. I encourage you to read the references pointed in the javadoc to understand all of this. the above example will generate 3 lod levels : the first is the original index buffer, and the 2 others will have respectiively a reduction of reductionvalue2 and reduction value 2. for example :
    the first one will be a version of the mesh with 10% less polygons, the second a version with 50% less polygons.

    #218693

    Wesley Shillingford
    833p
    Participant

    very nice :)! definitely heaps of improvement

    #218694

    zarch
    690p
    Keymaster

    The new one looks so much better, and since LOD is for far away the silhouette shape is what really matters – and the new one preserves it much better.

    + it’s not dependant on the ogre pipeline.

    Really nice :)

    #232062

    Normen Hansen
    2778p
    Keymaster

    The class is actually easy enough to use, we should add a SDK action before release..

    #232066

    eraslt
    22p
    Participant

    and where i can find this class now?

    #232088
    +2

    nehon
    1851p
    Keymaster

    @normen said:
    The class is actually easy enough to use, we should add a SDK action before release..

    ok I’ll add it

    @eraslt said:
    and where i can find this class now?

    here https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/tools/jme3tools/optimize/LodGenerator.java

    #232404
    +10

    nehon
    1851p
    Keymaster

    I’ve added the LodGenerator tool to the SDK.
    Here are some screens to describe the process.
    Hopefully that’s clear enough.



    Model is courtesy of @mifth

    enjoy
    EDIT…yeah i made some typo in the reduction explanation, I’m gonna fix it

    #232408

    zarch
    690p
    Keymaster

    Really nice work :)

    #240067

    Erlend Sogge Heggen
    501p
    Keymaster

    Does this have a wiki page yet?

    #240075

    nehon
    1851p
    Keymaster

    nope

    #242389

    Dustin
    13p
    Participant

    Ok Novice question here. How can I get this to download in my SDK?

    #242980

    Dustin
    13p
    Participant

    I have the RC2 SDK and I have selected the SDK nightly plug-in to be downloaded. However I cannot find this option in my right click menu also I don’t see it in the library either?

    Could someone help me with what could be the issue?

    #242981

    Dustin
    13p
    Participant

    I have installed a new copy of the SDK and I have the option available but when I attempt to apply the lods it does not generate the lods.

    #242982

    nehon
    1851p
    Keymaster

    Not sure you can get it from nightly. You can pull the repo (preferably the 3.0 branch) and build the engine from it.

    However still it’s a standalone class so you can just grab it from the source and use it.

    https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/tools/jme3tools/optimize/LodGenerator.java

    #242983

    Dustin
    13p
    Participant

    @Nehon

    I have install the current JME SDK installer and installed it. If I right click on my mesh I get the option to create the lods. I enter the proportions I want and when I click finish nothing happens. I still only have my main mesh in the lods list.

Viewing 15 posts - 1 through 15 (of 52 total)

You must be logged in to reply to this topic.