June 2, 2013 at 17:12 #218691+17
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
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.
Java12LodGenerator lodGenerator = new LodGenerator(geometry);lodGenerator.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL, reductionvalue1,reductionvalue2);Java12LodGenerator lodGenerator = new LodGenerator(geometry);lodGenerator.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL, 0.1f,0.5f);
the first one will be a version of the mesh with 10% less polygons, the second a version with 50% less polygons.June 2, 2013 at 17:32 #218693
very nice :)! definitely heaps of improvementJune 2, 2013 at 17:42 #218694
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 niceJuly 11, 2013 at 09:46 #232062
The class is actually easy enough to use, we should add a SDK action before release..July 11, 2013 at 09:53 #232066
and where i can find this class now?July 11, 2013 at 13:59 #232088+2
The class is actually easy enough to use, we should add a SDK action before release..
ok I’ll add it
and where i can find this class now?July 13, 2013 at 13:19 #232404+10
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
EDIT…yeah i made some typo in the reduction explanation, I’m gonna fix itJuly 13, 2013 at 13:36 #232408
Really nice workSeptember 1, 2013 at 17:35 #240067
Erlend Sogge Heggen
Does this have a wiki page yet?September 1, 2013 at 18:00 #240075
nopeSeptember 9, 2013 at 18:28 #242389
Ok Novice question here. How can I get this to download in my SDK?September 11, 2013 at 15:02 #242980
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?September 11, 2013 at 15:42 #242981
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.September 11, 2013 at 15:43 #242982
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.September 11, 2013 at 15:51 #242983
You must be logged in to reply to this topic.