Sign in to follow this  

[D3D12] Shadow map only renders on every other frame rtv.

This topic is 826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

im currently experiencing a weird problem. My shadow mapping only applies to the rtv im not seeing (Using doublebuffered swapchain)

 

Checking with Visual Studios graphics debugger shows that the shadow map is written fine (depth stencil texture with state transition to shader resource)

 

In the mid the picture i see while running the application. On the left the debugger output of the other rtv. Its always with shadow mapping applied. On the right the shadow map.

 

The Shadow map is always on one rtv, but this never seems to be the one visible. Its not even flickering (not one rtv with shadow map and one without), its constant without any shadows. Only the debugger shows the shadows.

 

 

Any idea what could cause this problem?

 

 

Edit:

 

Outputting the shadow depth texture as a diffuse texture just shows that the visible rtv somehow has a depth texture from camera perspective (the default depth stencil used). In the debugger, the other one rtv has the real shadow map applied. What the hell?

 

 

lLvvJbJ.jpg

Edited by Anthom

Share this post


Link to post
Share on other sites
yes i do. no error or warning. its that it binds my default stencil to the shadow texture. it uses the depth the the camera is "seeing" (default depth stencil texture) as texture i bind the svadow texture to. really weird behavior. i checked shadow texture and the depth stencil resources in the gpu debbuger and they are fine. as seen in the picture i posted.

Share this post


Link to post
Share on other sites

unbound? i created a dsv and a srv poinzing to the shadow texture resource. i use the dsv in the shadow pass and the rsv in the rendering/sampling pass. in between i transition resource state from depth write to shader resource state and back after sampling

 

Edit:

 

ok i got it working by unwrapping my class. looks like a resource lifetime problem or maybe lifetime descriptor problems. Now im able to wrap it step by step back into a class and check for errors.

Edited by Anthom

Share this post


Link to post
Share on other sites

Edit:

 

Just read: https://msdn.microsoft.com/en-us/library/windows/desktop/dn788714(v=vs.85).aspx

 

"Currently, there is one graphics and one compute root signature per app."

 

So my only option would be to deserialize the root signature and serialize again with new parameters? Or just define all possible tables at the beginning?

 

 

Original:

 

ok i isolated the problem and its my pipeline state object.

 

if i use the same root parameters as for the main shader, its working.

if i use different root parameters for each graphics pipeline (root signature and pso, each), and bind the shadow texture at descriptor table 0 instead of 2, i get the behavior i explained in the other posts.

 

in the multithreaded example from microsoft they are also reusing the same root parameters (or root signatures) for both pso`s?!

 

debug layer is not complaining about anything.

Edited by Anthom

Share this post


Link to post
Share on other sites

This topic is 826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this