Extended PSM (research paper, demo, code)

Started by
27 comments, last by gjaegy 16 years, 7 months ago
I have tried transforming unit cube to world space using inverse matrix, then I construct the 6 frustum planes using for each of them 3 points on each face of the world space frustum.

This doesn't seems to work, I guess because of the discontinuity of the world space frustum. I guess it looks like this (if I understood correctly ;):



it seems objects get rejected because of near plane where they shouldn't...

If I transform object bounding boxes into XPSM unit cube then it works, however I have to transform objects bounding boxes (which I already have in world space) into post projection space (so I have additional matrix/vector transformations), which I would prefer getting rid of...

So, maybe I should have a look at the way I contruct my planes...
Gregory Jaegy[Homepage]
Advertisement
actually it is quite strange. I have checked the front and near planes that result from the transformation of the unit cube into world space.

it simply seems that the plane normals are inverted, and I have no idea why.



the left red plane is the front plane, on the right the far plane. the normal should face each other in a normal case. the objects are between those planes.

I could simply check the orientation of the normals and fix them when required, however I would prefer understanding what's going on. any idea ?
Gregory Jaegy[Homepage]
Vladislav, I have a last question: when i have a high Coef value (for instance 0.01), the objects are project outside the shadow map (i mean outside the [-1; 1] interval.

Do you have an idea, where the issue could come from?

See that screen shot:
screenshot

the shadowmap is actually containing 4 slices (CSM), the upper left corner of the shadow map contains the first slices. see how the rotor model is being rendered outside the shadowmap, hence the shadow not complete...

Thanks a lot...
Gregory
Gregory Jaegy[Homepage]
is seems that bounding box not correctly constructed in PPLS. a) try to project casters/receivers in PPLS without W clipping, check how bounding volume points projected b) check how bounding box constructed, c) may be bounding box go extremely large\small.
without w-clipping (or by setting epsilon to 0 if I understand correctly), i get the missing part being shadowed, however, i get some areas that get wrongly shadowed:

link

I clamp my shadow map sampling tex coords to be sure they stay in the right quarter, and each quarter has a border of 5 pixels (to be sure) with value 1.0.

I think I know what happens.

the shadow map is cleared with 0xFFFFFFF -> z=1.0f

but your algorithm makes it possible to have Z > 1.0. see this screen shot:

z-1.0

I have rendered (z - 1.0) (Z being the z component of the result of the Position*XPSMMAtrix)... not black areas means Zxpsm > 1.0f.

I am not sure it is possible to clear a render target with a number greater than 1.0 (as it takes a DWORD as argument)... maybe by blitting a full screen quad with a pixel shader setting the right value.

However, is that normal that I get Z values > 1.0 ??



[ADDED]

I solved the issue by simply clamping the z value of the pixel being drawn to [0.0, 1.0].

However, it seems the whole mesh is still not being shadowed correctly:

screen

coef = 0.6, epsilon = 0;
Gregory Jaegy[Homepage]
ok, removing the w clip ( by commenting "if (w > wThreshold)" out) and using coef=0.01 and epsilon=0.85 it seems to produce better result.

maybe I am doing something wrong, however I am using nearly the same code as yours...

thanks for your help in any case.

[Edited by - gjaegy on August 30, 2007 9:15:32 AM]
Gregory Jaegy[Homepage]
hmmm, actually i still have the issue. I need to use a very low coef value (0.0001) in order to have it working in all situations, even without w clipping.

quite amazing, as your scene use 0.6 for that value...
Gregory Jaegy[Homepage]
if you get z > 1.0, something going wrong. you can get this result only if incorrect z range (Zmin = min(receivers.Zmin, casters.Zmin),Zmax = max(receivers.Zmax, casters.Zmax)) for PPLS focus region basis calculated. try to use low wThreshold (~0.1) value.
can you show, your XPSM code?

PS: high Coef value make sense only for very simple scenes, with only a few objects where you don't need to trade-off near-far shadow map resolution, however algo should work in this cases too. if you have problems when parts of shadows not in the shadow map, try to figure out how bounding volume points transforms into PPLS and how focus region basis constructed.

[Edited by - the_xmvlad on August 30, 2007 12:33:14 PM]
that with the Z was actually a bug I think. one of the bounding box of the object was not initialized, so....
sorry about that. i feel a bit stupid :(
[edited] actually I am not sure, as this bug was in a complex scene. that with the Z was with the simple scene where all bounding boxes were initialized... hmmm... i am quite confused...

I sent you a PM with the code I use, if you want to have a look....

The only thing i feel strange is that very small value I need to use for coef (0.0001) which means nearly no warping at all. and epsilon has only an impact on the Z value (more or less "black" when shadow map texture is renderded).

by the way, do you render objects normally or with cull_none ?

[Edited by - gjaegy on August 30, 2007 2:25:10 PM]
Gregory Jaegy[Homepage]

This topic is closed to new replies.

Advertisement