Sign in to follow this  

Shadowmapping: improving light proj. matrix

This topic is 4246 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, I read a short overview about LiSPSM. One thing they did, was to adjust the light proj. matrix in such a way, that it would perfectly fit "around" the camera frustum. Unfortunately they did not really explain, how this is done. At least I did not understand. You probably could change the light frustum planes until they fit, but that would not give you the proj matrix, would it? Another thing I wonder, is wether any texture I project from the light would become distorted in the process? Thanks.

Share this post


Link to post
Share on other sites
This is explained in the Perspective Shadow Mapping articles.
You build a bounding volume around all shadow casters and then you build the light view frustum around this bounding volume. This way you use the shadow map resolution in a very efficient way.
A reason why they do it, is, that you can also include shadow casters that are outside of the view frustum.

A different approach to do this is, just to construct the light view frustum for the whole screen and make it a bit bigger, so that shadow casters outside the view frustum are catched as well ...

Share this post


Link to post
Share on other sites
You are right, I did not think about objects that are outside the camera but cast shadows in it's way.

"You build a bounding volume around all shadow casters and then you build the light view frustum around this bounding volume."

I'm not sure I understand this. Wouldn't this bounding volume cover the entire scene?

Share this post


Link to post
Share on other sites
it depends on what you would want in there. So let's say you have a western movie and there are just three people standing in the middle of nowwhere pretty close to each other ... then you might only focus on these three guys, but you would not catch shadowing of terrain on terrain, trees etc. ..
So yes, the idea with the bounding volume does not look like a practical solution to me. I implemented the other solution that I covered in my post.

Share this post


Link to post
Share on other sites
So you make the light frustum fit around the camera frustum so to speak?
Thats what I am interested in. Is that covered in the perspective shadow mapping articles? Are spotlight textures distorted for you?

EDIT:
I supposes I could use the "improved" proj matrix for the shadows and the normal proj matrix for my spot texture, right?


[Edited by - B_old on May 1, 2006 3:38:24 PM]

Share this post


Link to post
Share on other sites
<<<
So you make the light frustum fit around the camera frustum so to speak?
<<<
The basic idea is to get the extrema of your view frustum and enclose them in an orthographic projection. This is how I did it.
I do not know if this is described anywhere already ... anyone knows anything about this?


- Wolf

Share this post


Link to post
Share on other sites
Quote:
Original post by wolf
The basic idea is to get the extrema of your view frustum and enclose them in an orthographic projection. This is how I did it.
I do not know if this is described anywhere already ... anyone knows anything about this?
That is how I did it.
Only thing that took me a while to grasp was how to get hold of the "boundingbox" for the camera frustum. ...basically I just defined 8 points, at the corners of post-projected space ( that is, -1 to 1 in a cube, z is handled differently in OGL and D3D..), and multiplied that with the inverse of the projection matrix. Voilá.
I can try and dig up the rest if it's needed.

Good luck!

Share this post


Link to post
Share on other sites
Quote:
Original post by wolf
The basic idea is to get the extrema of your view frustum and enclose them in an orthographic projection.
- Wolf

Well, the far plane of my view frustum is, well, very far away, so wouldn't it be better to check where the light frustum "cuts" the view frustum?
Maybe I misunderstood you, though.

Share this post


Link to post
Share on other sites
oh yeah I define the areas where the view frustum is sliced. For cascaded shadow maps I slice it in four pieces. So I only enclose those slices in the orthographic projection.

Share this post


Link to post
Share on other sites

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