Depth map shadow artifacts

Started by
19 comments, last by iequalshane 17 years, 6 months ago
Quote:Original post by simonjacoby
Sure, a depth bias will help you somewhat, but the problem with using a fixed depth bias is that it is scene dependent. You'll end up having to tweak it alot to look good for a particular light direction. Even when you do that, there will still be some angles where it won't work (you'll get light bleeding or surface acne), and if you change the lighting direction for the scene you'll probably need to re-tweak it some again :P

Oh agreed, biasing is evil and error prone. My favourite solution is to use VSM since in that case you can correctly output the variance for a given pixel using the derivatives of the depth (or the normal even). This will give pretty close to an exact result, modulo the areas where the derivatives are bad/undefined. Of course, I'm somewhat biased (pun intended) ;)

Advertisement
@andytx: I've got to try to implement VSM someday soon, I've looked at several demos and read papers (yours? :)) about it, but haven't taken the time to do it ;) The algo produces very nice looking stuff, excellent job on that =)

I have a question though: is it simple to extend it to work with projection warping methods such as LiPSM? It would be awesome to have a shadow system that covered an entire land- or cityscape with nice, high detailed soft shadows :)

Maybe combine CSM w/ 4-5 maps, LiPSM and VSM to get the ultimate real-time outdoor shadow system.. *dreaming* ;)
In order to fix some of my projection mapping issues I want to go ahead and just project the texture from the light in the shader itself. How would I go about generating the matrix I need to multiply the incoming position by given the position, orientation, perspective and aspect ratio of the light source's camera?
Quote:Original post by simonjacoby
@andytx: I've got to try to implement VSM someday soon, I've looked at several demos and read papers (yours? :)) about it, but haven't taken the time to do it ;) The algo produces very nice looking stuff, excellent job on that =)

Thanks - I think the idea is sound and can hopefully be extended by in the future to do even more cool stuff. And yes, I coauthored the paper with William Donnelly (Pragma here on GameDev).

Quote:Original post by simonjacoby
I have a question though: is it simple to extend it to work with projection warping methods such as LiPSM?

Yes, it's extremely simple to extend in that no work is necessary ;) We make no assumptions about the projection used, so projection warping is totally orthogonal.

Quote:Original post by simonjacoby
CSM w/ 4-5 maps, LiPSM and VSM to get the ultimate real-time outdoor shadow system.. *dreaming* ;)

There was an IOTD recently wherein someone had combined VSM and CSM with very nice results! I do think that the hybrid possibilities are many.

Quote:Original post by iequalshane
How would I go about generating the matrix I need to multiply the incoming position by given the position, orientation, perspective and aspect ratio of the light source's camera?

Not sure exactly what you're asking, but:

Spot light = Perspective camera
Directional light = Orthogonal camera

Use the same projection matrix that you used to render the shadow map.
I understand that, the only problem is in the current application I'm working with I don't have access to that matrix outside of the shader. I need to generate the matrix manually, which I'm not quite sure how to do.
Do it the (exact) same way that you did on the host.

Ex. if you used D3DX functions, do the computation outlined in the docs: D3DXMatrixPerspectiveFovRH
Again, I understand that. However, I do not have access to the code outside of the shader. I only have access to the shader itself. How the current setup works, I only gets matrices from the current view, so I need to calculate the matrices for the lights view independently.
Ah, well I can use that source for the calculations like you said, I will just try them manually. Can I just multiply the position incoming to the shader by that matrix in order to get the UV coords?

[Edited by - iequalshane on November 1, 2006 3:28:43 PM]
Quote:Original post by iequalshane
Ah, well I can use that source for the calculations like you said, I will just try them manually. Can I just multiply the position incoming to the shader by that matrix in order to get the UV coords?

Same as normal shadow mapping here - multiple position by light view/perspective matrix in vertex shader. Then in fragment shader, do the divide by w. Then rescale [-1, 1] into the range [0, 1] and you have your projected texture coordinates.

This topic is closed to new replies.

Advertisement