Improve the look of radiance map in Compatibility backend #97676
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #95091
There were 4 problems I found while digging deeper into this code:
Weirdly the first two issues were solved when I mapped the roughness properly. The tangent frame just has less of an impact when the sampling cone is larger.
The third issue is fixed by changing the order of the vertices.
The last issue is fixed by taking more samples at the higher mip levels. While 4x as many samples seems like a lot, its not bad as it only happens at mip levels with few pixels (e.g. for a 256x256 texture, it only changes the 16x16 mip levels and lower. Further rougher mip levels have fewer samples that succeed, and since we pre-calculate samples on the CPU and reject failed samples, we don't end up sampling 4x as much on the GPU.
The big difference in quality between the RD renderers and the compatibility renderer comes from the fact that the RD renderers use a texture array instead a single texture. In practice that means that the low mip levels use the same resolution as the highest mip level (e.g. 256x256). In the compatibility renderer we put rougher levels in higher mips, so effectively you are taking fewer samples. E.g. for mip level 5 in the RD renderers you would do 32 samples x 256256 (2,097,152 samples) for each face, while in the compatibility renderer you would only have 32 samples x 1616 (8,192 samples).
Slightly off topic, but still interesting despite taking 256 times as many samples, the RD renderer is not much slower because the GPU doesn't get saturated with only 8,192 samples. The real benefit of the compatibility renderer is lower memory usage, and fewer necessary passes.
Before

After
