Shadowmapping: improving light proj. matrix

Started by
7 comments, last by wolf 17 years, 11 months ago
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.
Advertisement
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 ...
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?
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.
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]
<<<
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
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!

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.

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.

This topic is closed to new replies.

Advertisement