Sign in to follow this  
IntegralKing

Dual Paraboloid Shadow Mapping + Deferred Rendering

Recommended Posts

I am trying to modify this [url="http://jcoluna.wordpress.com/2011/06/03/xna-4-0-light-pre-pass-alpha-masking/"]sample/tutorial code[/url] which demonstrates a simple light pre pass deferred lighting setup, so that point lights have shadows.

I am trying to implement dual paraboloid shadows, and I'm following this:
[url="http://gamedevelop.eu/en/tutorials/dual-paraboloid-shadow-mapping.htm"]http://gamedevelop.eu/en/tutorials/dual-paraboloid-shadow-mapping.htm
[/url]

The problem is that J. Coluna does lighting in camera view space, but the DPM paper finds the shadow map position by transforming a light pixel from world space into light space.. I think. This is partly because the DPM paper assumes that forward rendering is used.

See how J. Coluna's deferred shadows are done with a spot light here:
[url="http://olhovsky.com/shadow_mapping/SpotLight.fx"]http://olhovsky.com/...ng/SpotLight.fx[/url]

I don't have the world space position of the pixel, so I'm not sure how to find the tex coords to sample from in the shadow map.
Here's what I'm currently doing with point lights:
[url="http://olhovsky.com/shadow_mapping/PointLight.fx"]http://olhovsky.com/...g/PointLight.fx[/url]

[url="http://olhovsky.com/shadow_mapping/DPM_point_shadows3.png"]Click here to see what my point light shadows currently look like (with the wrong pixel shader transformations).[/url]


So what I can do, is reconstruct the world space position of the pixel, and then just find the sampling position in the shadow map -- I think that makes sense?

However, I'm wondering if I actually *need* to bother with the world space position of the pixel? J. Coluna seems to have no trouble sampling shadow maps for a spot light without using the world position of the pixel, so it seems that I shouldn't need it for a point light.

While I'm currently enrolled in a linear algebra course, and I'm working on understanding this math in more complete way, I was hoping that someone could help me with this in the meantime, so that I can make a meaningful contribution to this project.

Thanks in advance for any assistance! :)


P.S.:
I tried making a thread the other day about this issue, but I don't think that I was very concise, so I'm trying again, this time reducing the problem as much as I can. Hopefully this isn't viewed as a repost, as the question has been framed very differently :)


P.P.S:
If you'd like to try to help figure this out but need to see what is going on, just let me know and I can send you a copy of this project. (It uses XNA/C#).

Share this post


Link to post
Share on other sites
In your deferred renderer I assume that you are able to reconstruct your view space pixel position? With this information, you'll be able to get the world space position by multiplying the view space position with inverse view matrix.

Practically, if you need a position in any light space, just create a single matrix that transforms the point to the world space (inverted view matrix) and then to the light space (inverted light matrix). You can transform your position directly from view space to any other space. World space is the common space for your lights and cameras so for that reason you'll probably need to make it part of your calculations.

Cheers!

Share this post


Link to post
Share on other sites
Thanks for the assist Kauna :)

It actually turned out that my WorldViewProjection matrix was missing the world multiply in the creation of the shadow maps.

So all of the code I posted actually works! (as long as you set all of the matricies to the correct values :))

Share this post


Link to post
Share on other sites

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