Shadows affecting performance after upgraded graphics driver

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);

The debug info printed on startup is as follows:

INFO: Running on jMonkeyEngine 3.6.0-stable
 * Branch: HEAD
 * Git Hash: 53f2a49
 * Build Date: 2023-03-20
Apr 11, 2023 7:50:27 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: ATI Technologies Inc.
 * Renderer: Radeon RX 570 Series
 * OpenGL Version: 4.6.0 Compatibility Profile Context 23.4.1.230326
 * GLSL Version: 4.60
 * Profile: Compatibility
Apr 11, 2023 7:50:27 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
 * Graphics Adapter: aticfx64
 * Driver Version: 8.17.10.1698
 * Scaling Factor: 1

Is there any way I can troubleshoot or fix this? Why would upgrading my graphics driver suddenly cause shadows to become really expensive?

When I look at the Windows Task Manager the GPU usage is maxed out.

I am running Windows 10

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.

2 Likes

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):

performanceStats

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…

This is the stats with the faster driver.

performanceStats_fixed

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…

Try switching to lwjgl3 and see if it makes any difference. Though, this is just a random guess.

One more difference I noticed. The fast version prints this

Apr. 13, 2023 7:16:46 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1

Whereas the slow version says:

Apr 11, 2023 7:50:27 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
 * Graphics Adapter: aticfx64
 * Driver Version: 8.17.10.1698
 * Scaling Factor: 1

The faster version has "null’ for the graphics adaper and driver version.