Jump to content

Cascaded shadow map artifact


Go to solution Solved by Josh,

Recommended Posts

Posted

If I isolate each stage in the shader, each one displays fine. I think this is an error in the driver.

Added this to PBR/Lighting.glsl at line 269:

if (index != 1) return lighttype;

 

  • Sad 1

Let's build cool stuff and have fun. :)

Posted

I did some more testing and it looks like it might be a memory barrier issue, maybe. The pattern that appears looks similar to another problem I saw in post-effects, but I don't think the directional light shadow stages are all rendering each frame.

You can see here the divisions between stages are clean.

Untitled.thumb.jpg.f0e86c8e24086f3214f698ad2c9fcacf.jpg

 

 

Let's build cool stuff and have fun. :)

Posted

It's got to be a driver bug, or some obscure GLSL rule I don't know about. If I isolate one stage the shadowmap looks fine.

It looks to me like there is a problem when the texture that is used in a lookup is not the same across near neighboring pixels...

1.thumb.png.83db24d04d586c7ce6af6a7d619a3b15.png

2.thumb.png.9405b17480ae4c8da5215b0d4d69e156.png

Let's build cool stuff and have fun. :)

Posted

I got an interesting response that sounds right:

Quote

 

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.

 

https://community.amd.com/t5/opengl-vulkan/cascaded-shadow-map-artifacts-in-glsl/m-p/637976#M5009

  • Like 1

Let's build cool stuff and have fun. :)

  • 3 months later...
  • Solution
Posted

The core problem of this issue is now solved and will be included in an upcoming update.

I never did get the nonuniform feature working. I am not sure if it even works, and I am not sure if it has a negative impact on performance, and I just don't care,

 

  • Like 1

Let's build cool stuff and have fun. :)

Posted
On 10/11/2023 at 6:49 PM, Josh said:

Probably related, you can see a similar error in the terrain shader.

Untitled.thumb.png.7a311434828361ddcd0e70e0e0e7e25f.png

This seems to be fixed on AMD. I am not sure why because I did not merge the terrain textures like I did shadow maps.

Untitled.thumb.jpg.0602469d11224238e1514c9a4491f744.jpg

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...