Jump to content
  • Advertisement
Sign in to follow this  

DX11 [DX11] Sample Distribution Shadow Maps - Bug

This topic is 1538 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

Hey, first post! happy.png


I'm trying to implement a simple version of SDSMs in a Forward+ render-path, double checked everything but I keep running into this weird issue, where the output image looks all wrong (DevCtxt->Present):




Here's what's strange to me: if I step through the DrawIndexed events using the VS2013 debugger it looks correct - only the last step (Present) seems to mess with the image. I was lucky enough to quickly grab one of the (occasional) correct images at runtime:





Has anyone ever encountered something similiar?

It's definitely a mistake on my part but I can't pinpoint it after 4 hours.


I've attached the vsglog2013 files, which includes the pipeline states and the HLSL shader source, so feel free to comment on that. wub.png




1) I'm not caching any shadow maps whatsoever - I am using the depth-buffer from the last frame to calculate the SDSM partitions though (avoids a z-prepass in my case).


2) The shader code was generated using a model-driven HLSL development framework, so the #includes might look a bit messy - but it works! :-)





1) here's something weird I found out while debugging using the VS2013 graphics debugger:

the pixel shaders that do the final shading seem to fetch incorrect scale/bias values for the partitions (inside the shadow_fragment function). They differ from what the compute shaders output after the last (SDSM) Dispatch(1,1,1) call, which calculates the scale/bias values for each partition, by roughly ~0.1f, so it's not just a rounding error. Since the values of scale/bias can get quite large (e.g. scale.x=50.f), you can quickly tell that the shaders are accessing the right buffers ... it's just somehow slightly off.

Plus: everytime I manage to capture a correct output image, the values match, i.e. correct shadows. ATM I'm guessing that it's the debugger that is just showing me the wrong values in the PS for some reason ... how else could that error possibly happen when I don't touch those values after saving them to the buffer using Dispatch. That assumption however leads me back to square one ... HELP ME! :-D

Edited by yoshi_lol

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!