Rougness/RefCap: Enormous performance impact

Attempting to optimize, I’m looking at the impact of Roughness on performance - and what I’m finding is very surprising!

FPS drops **from 180 to 65 (!!) **as I’m changing **only **the roughness in my material!

My test scene is:

  • Using **only **static lights, baked lighting
  • Postprocess with SSR disabled
  • Several Reflection Captures with 512k resolution

My material is:

  • On a low-poly object with just one material assigned
  • Using 2K Roughness, Diffuse, Normal maps, a very basic material
  • Using no bump-mapping, no parallax, no ambient occlusion, no specular map
  • Blend mode: Opaque, Shading model: default lit, Single sided.

I’ve tried a number of things to understand the problem:

  • Getting similar results for DX11/DX12 and Forward/Deferred rendering
  • Using less Reflection Captures in the scene lowers the impact, however I’m nowhere close to reaching memory limits and I see an impact even when reflection captures that are out-of-range are removed
  • The <docs> on Reflection Environments explicitly state that Roughness should not have noticeable impact on performance

So what’s going on here? Is this normal behavior?

Here’s two screenshots with the stats from High/Low roughness:

On a PBR standp point, I believe you should be changing the specularity while the rougness should be a fixed value.

either way, since you have no speculairty set give it a shot and see if it performs differently.

The latest engine release does have a few rendering issues. This could very well be one of them…

You mean that adding a specular map can help?

Not sure I understand your PBR argument. What I’m changing is the roughness to get the right look on the material (in this case, getting a more ‘wet’ or ‘smooth’ look on tiles). How does specularity play in to this?

You can see in the STAT GPU the ReflectionEnvironment goes from 1 ms to 10 ms, and that could make sense since changing the roughness means that the renderer need to do a sort of multi-sample for the reflection maps.

I’m not expecting that much drop though.

I suggest you getting yourself a bit more familiar with PBR.

Unlikely. Impossible to tell without seeing the scene. You can potentially clog reflection environment shader by stacking myriads of reflection captures, but 10ms is just unrealistic.

Yeah, it is definitely an issue with multiple Reflection Captures. Thing is, in the bottom of <link> it says:

While:

  • When I disable all but one RefCap, performance goes back up
  • The RefCap influence areas are not actually overlapping in the test level (they are placed in various areas of the level) but they still heavily impact performance
  • Performance impact is very low with a higher Roughness and scales seemingly linearly up as I try with lower and lower Roughness

So the behavior seems to contradict the statements from the UE4 docs. I’ll do some more testing to see if I can isolate the issue further. Thanks for the input so far and please let me know if you have further ideas.

Double check that you are not using reflection capture with manually specified cubemap, which does not have mip maps.

Perhaps you should construct a blueprint to place that removes the reflection capture when not in use and occluded?
the issue could simply be that they are all being used and end up rendering too big an area…
alternatively a level wide box capture to cap the size of of the texture?

@Deathrey

Reading the docs, within the unreal PBR flow, for something like rain you change specular, not the roughness of the object.

Though as I said, I doubt changing one or the other will make a difference in rendering cost.

So I took some time to isolate the issue further, creating a test level that you can find attached to this post (just download, unzip, open, build, play, and look straight down for maximum effect).

In this project I have added:

  • Postprocess to exclude SSR and AO
  • Many Box RefCaps (only 1 overlapping the central mesh, the rest spread out over the level)
  • 512k Res for the RefCap
  • DX12
  • RefCaps, while not overlapping the reflecting mesh, do all have transition distances that are not small (but also after transitioning out, do not overlap the mesh)

Here, when run in 4k and looking straight down, the cost of the reflection environment runs up to 50ms (on a 1080 Ti) with low roughness, while not getting above 5ms with high roughness.

What do you guys think? Time for a bug report? Or expected behavior?

I would like to point out again that, according to UE4 docs linked above:

I don’t know if it’s too drastic of a difference (50 ms and 5 ms) to report a bug. There are other things to account for, such as the computer’s specs, how reflec captures are culled based on roughness and influence radius (if they’re more spread out, perhaps there’s way less culling due to large transitions between them in low roughness), and the resolution. 50 ms is 10 times slower than 5 ms, but it’s still super fast. It could be something else contributing that hasn’t gotten attention yet.

As far as I understood it:
The reflection works by just blending a texture the engine produces (when building reflection captures) and the regular material - based on the values found in specularity and roughness.

obviously, there is no way that blending 2 textures together should come to cost 10 times more based on the “alpha”.
I could see it happening if the reflection captures were capturing in real time, maybe.
But the whole point of the reflection captures is that they become static at runtime.
I see no reason for this increased cost.

I’ll try your project when I can.

To be honest, the 50ms is a bit of an edge case in the TestLevel, where we tried to isolate and highlight as much as possible the issue…

But still, in our case we’re doing VR and need to stay under 11ms total, making this a big issue for us that puts severe limits on the use of RefCaps and reflective materials… Which seems like it should be unnecessary if the impact of Box Ref Caps was culled differently.

It appears to me that the captures are only culled on distance, as makes sense with the Sphere Reflection Captures, but not so much with Boxes.

Looking forward to your view when you’ve had time to have a look!