How to optimize rendering - updating shader uniforms takes more than actual drawing

Hello,

fps with my scene is currently too low. I profiled the rendering and it shows that updating shader uniforms takes more than actual drawing.

This scene has about 100.000 Geometries and about 50 different Materials. I have used “Common/MatDefs/Light/Lighting.j3md”. Scene is also static. Is there any way to cut down or avoid these uniform calls?

JProfiler tree:

http://i.imgur.com/FbqVj.png

Yes you need to batch your geometries, look at GeometryBatchFactory.optimize()

Thanks for very fast reply! Yes, it’s now a lot faster. Anyway I don’t think I can use it, because Mesh and transforms are the only static in my scene. The optimization merge the meshes to big meshes and it makes following things problematic:

  • Materials of Geometries changes often e.g. the Material of user pointed Geometry is changed.
  • Visibility (CullHint) for Geometries is changed often
  • I’m planning to implement node based contribution culling (Small nodes on screen are hided).



    Debugged the uniform setting and it seems like it updates all uniforms although most of them are equal for all like shininess in my case.
1 Like

Still, you will have to go this way. Look at mythruna for example, everything changes all the time and it works fine.

mazander said:
Debugged the uniform setting and it seems like it updates all uniforms although most of them are equal for all like shininess in my case.

Mhh maybe some optimization can be done indeed, but still 100000 geometries is too much you'll have to find a way to batch them.
1 Like