I recently upgraded my graphics card driver and then noticed the performance of my JME application dropped dramatically. Previously it ran at around 35FPS and now I am getting 6FPS.
After a bit of trial and error I worked out that the performance hit was caused by the shadow renderer I am using. When I disable the DirectionalLightShadowRenderer the performance goes back up to 32FPS.
sun = new DirectionalLight(new Vector3f(-0.1f, -1f, -0.1f).normalizeLocal(), ColorRGBA.White);
rootNode.addLight(sun);
final int SHADOWMAP_SIZE=1024;
DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE, 3);
dlsr.setShadowIntensity(0.25f);
dlsr.setLight(sun);
viewPort.addProcessor(dlsr);
Real time shadows are really expensive in jMe3, and it depends on how big the scene is
The workaround for me is to use baked shadows for static object and turn off the shadows for far away dynamic objects
If you want day/night you have to optimize the using of shadows
35 FPS is already really low. You should look into optimizing your scene.
Have you confirmed that going back to the previous version of the driver fixes the performance problem?
ATI drivers are really chaotic and sometimes it takes some skill to figure out the right version to use.
Anyway, one thing you can do is look at the actual profiling information that JME can already provide. Step 1 would be to post the rest of the stats that show up in the HUD but there is also advanced profiling and such.
I downgraded to an older driver from July 2022. This driver had the same issue with performance of shadow rendering.
I then managed to downgrade to the original driver I was using (from December 2021). This fixed the performance issue.
So yes, going back to the previous driver version does fix the performance problem.
btw measuring the frame rate now with the fixed driver, the frame rate does hover near 60FPS (which is the monitors refresh rate, using vsync)
As suggested, the stats from the HUD are as follows (this screenshot taken from when the performance was bad):
I would still like to get to the bottom of this.
I would like to keep my graphics driver up to date and not have to stay on an old version
I would like to be confident my program takes full advantage of the graphic hardware that is available
I am wondering is this related to jmonkeyengine at all, or is it a broader issue with the driver / hardware combination? I did try running some other games and they seemed to run fine with ultra shadow settings, but that may not mean much…
One thing I notice is the number of FrameBuffers is a lot higher in the faster version. Does this mean anything?
As far as I know I am running the same version of my software…