VSM & LiSPSM

Started by
1 comment, last by myleo 18 years ago
Hello, I am trying to combine my implementation of VSM and LiSPSM. Both of them seem to work fine seperatly, but I get a strange result when I try to combine both techniques. The problem is the storing of the distance to the light position in view space in the shadow map itself (moments.x). The position from where the LiSPSM is created is not really in the direction of the light (Sundir for me) anymore. In theorie I would think that the position from where you store your distances wouldn't make a difference for VSM, but somehow my position can be inversed by LiSPSM I think, because it stores negative distances to the light. Points in shadow seam closer to the light when I look into the sun direction. When the sun is behind me, the correct distances are stored. Any idea what the reason could be for this? When I use the view matrix and light position from my normal shadow mapping camera the results are correct (I still use a LiSPSM view proj matrix to transform my vertices in the vertex shader). The problem is here of course that my quality is not so good, because I can't take full use of my LiSPSM matrices. Regards, Kenzo
Advertisement
I'm not particularly familiar with LiSPSM, but I assume that it has to maintain the invariant that the post-projection "z" values are correctly ordered with respect to the light source. Therefore worst case, you can simply use them as your depth metric. However since they are usually quite nonlinear (unless LiSPSM messes with that?), they may not produce adequate precision throughout. That said, it's something to try.

I'm assuming from your post that LiSPSM modifies both the view and projection matrices when rendering the shadow map. Thus another potential depth metric to try is the distance to the center of projection... something like:

position_light_space = LiSPSM_view_matrix * position_world;distance = length(position_light_space);position_homogenious = LiSPSM_projection_matrix * position_light_space;

...and something similar when doing the shadow map comparison. Note that this involves storing TWO matrices instead of one (the composite view/projection), but it may produce better results than the above.

Anyways, first try using the post-homogenious-divide "z" value. If that doesn't work well, try the length of the position vector in the SHADOW's "view" space.
I am trying the shadow effect in dynamic scene too,and I have used the shadow map, PSM, Light space PSM.
But I found that--when I rendered the model with color, the shadow was right; when I used one texture mapping onto the model in the scene, the shadow disappeard. I have got some demos, but none of them used more than one texture in the program--there was only one texture(depth map texture). Why? I have no idea.

This topic is closed to new replies.

Advertisement