Performance of many geometries

FPS of my application start to get to worryingly small levels for the small amount of content I have there. I was considering optimizing some meshes etc, but after a bit of playing around with gDEBugger, visual vm and switching off and on of some geometries, problem lies elsewhere.



I’m not vertex or fill rate bound - it seems that I’m geometry (like in jme3 geometry instance) bound. Due to the model format I’m using (NWN1), some of my models are composed from 40-80 small pieces, each with separate transforms. I have some thousand-triangles models in the scene, but they barely affect the perfomance - but adding 50 or so small geometries with 20-50 triangles each has a lot more noticeable effect.



All of this is even more pronounced because of bloom and shadow filters, which end up repainting everything twice, on top of normal render.



At the moment, I’m ending up with doing 14k opengl calls per frame to display just 4 complicated models… most of them related to glUniform*, setting texture values and binding geometry.



Benefit of the part system for models is that there is a lot of things which share exactly the same settings - same texture, same values for all the shader parameters (except for world/view transforms of course). On top of that, with multiple instances of same model, meshes themselves are static and shared, as they don’t have to be modified on runtime.



What kind of sorting jme3 applies for opaque objects? Is it configurable? I suppose that in my case, sorting by shared mesh would be most beneficial (as it would be guaranteed to have most of the other parameters the same) and after that sorting by texture.



Another point - from what I understand, for blur filter with glow-objects mode, every object is rendered, even if it has no glow texture or glow color (which is true for most of my objects). Maybe some kind of optimalization would be possible here, like with Shadow.Cast/Receive flags ?





Other option for me would be to group the geometries myself and do some kind of bone-animation approximating the original part-based simulation - but some of the models have 100+ ‘bones’, so I’m bit afraid it would require a lot of handtuning anyway.

Yeah i would suggest to “group” all the different geoms of a model, modern GPU are optimized to handle a crazy amount of polygons in one draw call, but are not really good at successive draw calls.

That’s why batching comes in handy.



For sorting opaque geom the queue use an OpaqueComparator, http://code.google.com/p/jmonkeyengine/source/browse/branches/jme3/src/core/com/jme3/renderer/queue/OpaqueComparator.java

It’s not really meant to be customizable though… (as far as i know)



For the bloom filter, yes if you use object glow, every object is rendered even if it has no glow map or glow color.

I don’t really want to create another queue, but there must be a way to optimize this indeed.



Also for shadows we are planning to implement static lightMaps/shadowMasps supports. So If you have a static light source, you can bake shadows of static objects in a texture, and use PSSM only for non-static objects. This should give a nice boost to shadows rendering.

Also for shadows we are planning to implement static lightMaps/shadowMasps supports. So If you have a static light source, you can bake shadows of static objects in a texture, and use PSSM only for non-static objects. This should give a nice boost to shadows rendering.



Please make it possible to generate them without jmp,

please make it possible to generate them without jmp,

please …



uh…honestly I did not think of a way to generate it …I was more thinking to generate it in an an artist process…maybe in Blender, max, or anything else…

But now that you mention it it could be awesome to be able to generate it with JMP!!!

Now you have another reason to switch to JMP…really, don’t thank me :smiley:

Fu I don’t hate the jmp platform, but I hate netbeans, for unknown reasons.

Well either way I could just rip the classes out of the jmp ^^

yeah well anyway, if there is a way of doing this…it must come from the engine really, JMP can’t compute shadows on its own…so i guess there will be a way to do it without JMP :wink:

Empire, for people like you I added codeless projects to jMP, so you can only use the editors etc. and code in whatever IDE you prefer.

normen said:
Empire, for people like you I added codeless projects to jMP, so you can only use the editors etc. and code in whatever IDE you prefer.


how does this work? , cant see anything explicitly indicated updated jmp 20min ago, I keep it around but ike empire it does not really support my working habits .......eclipse supports my bad habits better.
normen said:
Empire, for people like you I added codeless projects to jMP, so you can only use the editors etc. and code in whatever IDE you prefer.



This sounds intresting , might take a look at it

Select File->Import Project->External Project Assets (dont use the Eclipse Project importer, I gotta massage that a bit more to work properly with jME projects).