Open mrjustaguy opened 2 years ago
I wonder if the shadow resolution could be calculated automatically based on the reflection probe cubemap size instead.
Also, we need to check if this affects both directional and point light shadows, or just point light shadows. As I understand it, point light shadow atlas size is set on a per-viewport basis, but the directional shadow size is global.
Hm, it also seems like Soft shadows are playing a big part in the Reflected shadows, and are actually one of the more damaging parts of performance for Reflection Probes...
Do note, Both Directional and General Shadow resolutions need to be effected by Reflection Probe overrides to make any sense... Testing out the effect of Reflection Probes on my hardware with Shadows on and off (directional only), between 16k Ultra soft shadows and 4k Hard shadows, here are the results:
16k Ultra, Reflection Shadows On - 6 FPS 16k Ultra, Reflection Shadows Off - 13 FPS 4k Hard, Reflection Shadows On - 20 FPS 4k Hard, Reflection Shadows Off - 26 FPS
From this I've calculated that it takes roughly 90ms for 16k Ultra Shadows in Reflection Probes, compared to 12-13 ms for 4k Hard Shadows. That means implementing Reflection Probe Shadow Resolution and Softness for directional lights alone would increase the Reflection Probe performance by 7 times with shadows on when making this sort of a cut to RP's Shadow Resolution.
Here's what The Performance would likely be around: 16k Ultra Soft Shadows, Reflection Shadows On at 4k Hard ~ 11 FPS, which is nearly double the FPS in that especially demanding scenario, without easily observable Loss of quality in most scenarios, compared to Lacking Reflected Shadows that can be quite an obvious loss of quality.
P.S. The test was ran on a Quadro K2000 at 1080p, a decade old potato of a GPU, even more modern Intel higher end IGPUs are more powerful, so 16k Shadow maps with Ultra soft shadows and Reflections that have shadows is a realistic use case for Higher Settings on Higher end Systems.
Reflection Probes should probably override Directional Light Split options, Orthogonal gives a gigantic performance increase with Reflection Probes, while still maintaining fairly good Shadow quality, 2 splits gives a middle ground to 4 splits, and is probably the most quality a Reflection Probe can benefit from.
This ofc would require the ability to tweak Reflected Directional Shadow Split distances and Max distance...
The defaults for Directional Shadows in Reflections should probably be 2 Split, with 0.1 split and 100m distance, and 1024 shadow map, maybe 2048 if we go down for some more quality, however the Reflection Probe isn't really benefiting much from greater shadow resolutions, as even if the settings above are set to 2 split, 0.1 and 1000m, the 1024 shadow map looks just fine, as shadows are generally only visible in close up objects, and there isn't much of a change in shadows visible in the reflection probes anyway even with higher resolutions, because the reflections themselves are just so low resolution that only close objects get any detail.
If reflection probes receive a resolution property, I would like to note having a global setting in the RenderingServer would be useful as well to control reflection probe resolutions globally similar to the soft shadow quality. So games could control the resolutions during runtime for example to let users tweak settings.
Maybe a resolution property in the ReflectionProbe node should therefore be relative from the project-wide value.
Describe the project you are working on
Interior Reflections
Describe the problem or limitation you are having in your project
Reflection Probe has to have Shadows to avoid serious light leaking, but it renders it's own shadows, at the same resolution as the shadows normally do, but that level of detail isn't needed and is bad for the performance of the reflections.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Much like with the LOD threshold in Reflection Probes, add Shadow Resolution to allow for rendering lower resolution shadows for the reflections for improved performance while still getting the benefits of shadows in reflections.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The Above sums it up.
If this enhancement will not be used often, can it be worked around with a few lines of script?
no.
Is there a reason why this should be core and not an add-on in the asset library?
Reflection probes are core.