LOD and jME3

Is there any C/LOD tutorial for jME3? If not, what classes should I use for enabling LOD and improving performance?

I dont think there are any tutorials for JME3 right now but if you downloaded one of the latest nightly builds you can find a TestLodStress class in the jme3test.stress package which pretty much shows how to use LodControl.

Take a look at the hovertank it already uses lod

Hmm, I did this:



[java]

modelNode = (Node)game.getAssetManager().loadModel(“Models/Oto/Oto.mesh.xml”);

modelNode.setLocalScale(0.5f);



Geometry g = (Geometry)modelNode.getChild(0);

g.addControl(new LodControl(g));

[/java]



But it throws an error - LOD levels are not set on this mesh



How to fix this?



Thanks.

Your model doesnt have any LOD Levels. You can create LodLevels with the Ogrecommandline tools, which you can get at the Ogre3D homepage under “Tools”. Then just go to your commandline and type

>OgreXmlConverter -i path/to/your/model.mesh.xml

and follow the instructions. You might have to try alot of different values for the LOD until it fits your game :)

(Level of Detail Levels? weird :) )

And if I want to use for example .obj instead of the Ogre model format?

The Ogre tools are also integrated in jMP, just right-click an ogre mesh.xml file and select “advanced import” then you are presented options to add LOD etc.

No error on OgreXmlConverter:



[java]File header written.

Writing mesh data…

Writing submesh…

Exporting submesh texture aliases…

Submesh texture aliases exported.

Exporting dedicated geometry bone assignments…

Dedicated geometry bone assignments exported.

Submesh exported.

Exporting skeleton link…

Skeleton link exported.

Exporting LOD information…

LOD information exported.

Exporting bounds information…

Bounds information exported.

Exporting submesh name table…

Submesh name table exported.

Exporting edge lists…

Edge lists exported

Mesh data exported.

MeshSerializer export successful.

Unregistering ResourceManager for type Skeleton

Unregistering ResourceManager for type Material

Unregistering ResourceManager for type Mesh[/java]



But still same error.



Anyway, I don’t really want to use this Ogre model format. How can I enable LOD if this Collada or obj for example?

You dont get animation with obj or Collada (which is not supported anyway).

Check the XML file for something like this:

[xml]<levelofdetail numlevels=“5” manual=“false”>

<lodgenerated fromdepthsquared=“1”>

<lodfacelist submeshindex=“0” numfaces=“1102”>[/xml]



If it doesnt exist something probably went wrong with the conversion.



I dont really know if there are any tools like this for collada and obj, sorry! -and what Normen said :smiley: -

For some reason it didn’t change the xml file.



Anyway - Which formats has animation and supported in jME3 except Ogre format?

It doesnt change the xml file, it creates a new one and imports that. No other format supports animation.

Only ogre . deal with it ^^

You can convert OBJ to Ogre via Blender. Like was mentioned, jMP has an extra option to generate LOD levels for ogre models on importing.

been trying to use the Advanced JME binary converter with no luck. I right click on the mesh.xml file in JMP and click Advanced JME Binary converter and set the reduction % and click import NOTHING happens no new xml gets generated. Is that feature working?

also if I wanted to set three LODs do I do three different imports or set all 3 and then click import?

regardless I’ve restarted and tried different things, nothing is happening.

edit: sometimes I notice at the bottom right that there’s a loader saying Converting OGreXML but it’s indefinite, I waited 15+ mins for it with no change.

@nightwolf911 said: been trying to use the Advanced JME binary converter with no luck. I right click on the mesh.xml file in JMP and click Advanced JME Binary converter and set the reduction % and click import NOTHING happens no new xml gets generated. Is that feature working?

also if I wanted to set three LODs do I do three different imports or set all 3 and then click import?

regardless I’ve restarted and tried different things, nothing is happening.

edit: sometimes I notice at the bottom right that there’s a loader saying Converting OGreXML but it’s indefinite, I waited 15+ mins for it with no change.


You on linux?

Well. I’ve spent nearly 2H on it, but I still failed importing a simple sphere into JME with LOD.
I’m using Window and JME3 RC2.

I installed OgreCommandTools just to be sure, but still not better.

Here is my steps. Please correct me if something is wrong

  • Build a sphere with material in blender 2.65a
  • Export with 5 LOD activated
  • Import in JME => no LOD level
  • Advanced converter in JME with various parameters => no result / hangs forever / Crash of Ogre (depends on ???)

I also tried to use the command tools :

  • generate 5 LOD => ok
  • generate 5 LOD with distance => hangs / Crash

Then import resulting file :

  • import in JME => no LOD
  • advanced converter in JME => Hangs on “parsing LOD”, then crash of Ogre

One time, I’ve managed to obtain a J3O with LOD… Don’t know exactly how… but each LOD is the same. Same vertices and faces, same aspect.

Any idea ?

I just tried. And it worked fine.
I used Jaime ogre file, right click “Advance binary conversion” choose 3 levels with 30% reduction, checked “tangent generation” (not needed for lod) and i get a model with 3 lod levels (after few seconds).
To view lod levels you have to open the model select the geometry and change the levels in le “Lod level” property (this is not the total number of lod levels you have, it’s the index of the current lod level)

I’m on windows 7 64 bit though, maybe there are difference due to OS.
Maybe you should try with Jaime model, It can be related to the model too…

Sorry, but I can’t find Jaime model. There’s the J3O file int the test-data jar, but not the xml.

Ok, after some more look into…
The model with LOD IS different. Only the vertex/face count of the Scene Composer is not updated.

Mea-culpa. I’ll do some more tests.