PostProcessing without being slow

I’ve been looking at some filters to use in my game, and I’ve found a few that I think would look good (mainly ambient occlusion).

The problem is that the SSAOFilter (ambient occlusion) slows my program way down when I use the code from the light and shadow wiki.

How can I optimize this to bring my frame rate up again?

What was “fast”? What is “slow”?

What resolution? How many objects?

Easiest way to improve performance is to turn off SSAO.

Else you can play with the settings of SSAO, reduce the sample radius, etc.:
https://javadoc.jmonkeyengine.org/v3.3.2-stable/com/jme3/post/ssao/SSAOFilter.html

Also you can enable Approximate Normals which should give better performance:

well, SSAO will always lower your framerate. It require many calculations.

To optimize, do what Paul and Ali said, but i belive that lower scene tris-amount also might help(since it need normals?)

In your place, i would also rather look WHY your game work in low framerate in general.

Most important part would be Geometry amount, how many you have of them? render calls and tris-amount and custom-code was always most fps consumable part for me.

This is an assumption.

Sometimes when someone says “slows my program way down”, they mean it used to run at 5000 FPS and now runs at 3000 FPS… which is a non-metric.

Thus my original questions about what fast and slow mean.

Fast as in 60fps, slow as in 0-15fps.

Do note that there are also built in profiling features that can display frame timings.

1 Like

yes, thats definetly something wrong with SSAO or related things if this go so low.

for me to compare it would be like 70 fps → 60 fps

When I was starting on jME years ago, poorly written Controls and AppStates used to be source of slow fps due to my misunderstanding of how they work. Analyzing my code with profiling tools like VisualVM helped me to find and improve problematic code snippets.

exactly

I’m pretty sure it isn’t my code that is the problem. It runs at 60fps with no hang-ups, but as soon as I implement SSAOFilter, it dips to 15fps.

Post can’t be empty.

best option is always to create simple standalone TestCase.

You never know, you might be adding SSAO 10x times for some reason as example.

Its also a way to give us some code so we might check ourselfs.

Also, per-pixel post-processing effects will slow things down a lot more if you are running at 4k resolution versus 1280x720, etc… or with AAx16 enabled.