Sign in to follow this  

OmniDirectional Shadow Mapping

Recommended Posts

Hello all,


I've done simple directioal light shadow mapping, but now I'd like to try my hand in point light shadow mapping.


I've decided to shoot for cubic shadow mapping, so I've already setup up a cubic renderTargetView/DepthBuffer/ShaderResourceView and rendered my scene from the view point of the light in the x,x-,y,y-,z,z- directions.


Now I guess I've come to a bit of a standstill on how to best approach this in a shader perspective.

My Initial thought was to send six LightViewMatrices and check against each of them in my pixel shader for the shadow map textureCube.


But that's a lot of overhead! And a lot of data to send down the bus per frame.

Is there a better way to approach this? Especially since I'm using a point light and textureCube construct in my shader.


Any response is appreciated!


Marcus Hansen

Share this post

Link to post
Share on other sites
6 matrices per frame is not much -- 384 bytes per light per frame frame. 100 lights at 60Hz might add up to 2MB/s, over a bus rated in GB/s :)

For comparison, an animated character might have 100 bone matrices supplied per frame.

But... Why do you need 6 matrices? The cube itself has one rotation and one translation value, which should be identical for every face, right?

Also, seeing as it's omnidirectional, you you even need to support rotation at all? A simple translation / light position value should be enough.

[edit] i.e. Subtracting the light position surface position gives you the direction from the light to the surface, which is the texture coordinate to use when sampling from the cube-map.

Share this post

Link to post
Share on other sites

Your right I was approaching it in a pretty convoluted fashion :p. 

Anyhow I got it working using a single matrice for the point light. Now I just have deal with some peter-panning of the shadows


P.s. I don't know why but it makes me cringe to have to send more data to the shader then just a few matrices and a variable or two.

      I would imagine however doing PCF in the pixel shader to be a bit more intensive

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