Our new renderer is displaying graphical artifacts in the cascaded shadow map implementation. This seems to occur near the dividing line between different shadow stages. It's almost as if the fragments are divided into regions that aren't completely independent from one another, and the shader logic gets confused if two neighboring fragments do a texture lookup on different textures. If I discard all but one stage, that stage will appear correctly with no artifacts.
GPU: Radeon 6600
Driver: adrenalin-edition-23.9.3
OS: Windows 10 64-bit
API: Vulkan 1.3
I will send the download link in a private message.
Here's another shot in-editor with the stages colored:
The code that handles this at line 252 of "Source/Shaders/PBR/Lighting.glsl":
Solved! Go to Solution.
Hi, I have an update on this issue.
The original problem was caused by the requirement for dynamically uniform expressions, which I did not fully understand at the time.
I did get the problem solved by merging all shadow maps into a single texture.
I was not ever able to get the nonuniformExt() feature to work. This might be due to my own error, or it might not be working on AMD drivers.
For my purposes, this problem is resolved.
Hi @joshklint
Does it occur in the other configs you have? I want to make sure we isolate this issue down to AMD specific hardware or driver bug rather than an implementation specific issue.
Thanks,
Owen
This artifact does not appear on my non-AMD hardware and has not been reported by any users with non-AMD hardware.
Created internal ticket SWDEV-426735 to track this issue.
Thanks,
Owen
This might be an artifact resulting from indexing and sampling textures using a non Dynamically uniform expression. AMD hardware needs the sample index to be the same for all active invocations inside the subgroup.
One fix would be to do:
#extension GL_EXT_nonuniform_qualifier : require
textures[nonuniformEXT(index)]
So wrapping the texture index inside of the nonuniformEXT function which exist exactly for cases where you need non dynamically uniform ressource indexing.
Your description is a plausible explanation for this problem, but adding the extension did not have any effect on the appearance.
I changed this code:
Ok, I've only ever used nonuniformEXT in OpenGL so I dont know what you need in Vulkan to properly use it, but seems like you got it.
I wonder if the automatic derivatives could be an issue as well or if thats irrelevant when using shadow samplers.
You can try by sampling with textureGrad and just hardcoding the derivatives to 0.0, see if that does something.
I have updated the example to enable the following Vulkan 1.2 features:
physicalfeatures1_2.shaderSampledImageArrayNonUniformIndexing = VK_TRUE
physicalfeatures1_2.shaderStorageBufferArrayNonUniformIndexing = VK_TRUE
physicalfeatures1_2.shaderUniformBufferArrayNonUniformIndexing = VK_TRUE
The new EXE will show "Nonuniform indexing enabled" in the window title bar.
I tried putting nonuniformExt() around a lot of buffer and uniform indexes in the PBR/PBR.frag shader, but nothing I tried seemed to have any effect.
I am sending a new download link to Owen now.
Hi, I have an update on this issue.
The original problem was caused by the requirement for dynamically uniform expressions, which I did not fully understand at the time.
I did get the problem solved by merging all shadow maps into a single texture.
I was not ever able to get the nonuniformExt() feature to work. This might be due to my own error, or it might not be working on AMD drivers.
For my purposes, this problem is resolved.
I also want to add that our solution was implemented with OpenGL, but I saw a similar situation where the OpenGL driver did not exhibit the same issue with invocation groups. I have not actually verified that our solution solves the problem in Vulkan and do not plan to continue investigating this.