Sign in to follow this  

a question about VSM.

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

I use the Parallel-Split Shadow Map and VSM for sun light,so i use the orthographic projection. Because VSM need all object(caster and receiver)'s z in light space is between 0 and 1.0,so when i calculate the projection matrix,i must include the receiver in the view volume. In my app the receiver is much biger than caster,so only a small area of shadow map is used. I want to only include caster in the view volume,anybody can give me some suggestion? Thanks. [Edited by - ChenA on August 15, 2007 6:06:31 AM]

Share this post


Link to post
Share on other sites
You only need the portion of the receiver that will be shadowed. Then in your shader if the compute shadow map texture coordinates lie outside of [0, 1] (in either dimension), simply consider the area "lit".

Thus you need only make the projection large enough to cover the castors, plus any blurring that you do to soften shadow edges. Note that you still need to render the receiver into the shadow map (as usual for VSM), but you don't need to include regions that won't contain any shadows.

Share this post


Link to post
Share on other sites
Quote:
Original post by AndyTX
You only need the portion of the receiver that will be shadowed. Then in your shader if the compute shadow map texture coordinates lie outside of [0, 1] (in either dimension), simply consider the area "lit".

Thus you need only make the projection large enough to cover the castors, plus any blurring that you do to soften shadow edges. Note that you still need to render the receiver into the shadow map (as usual for VSM), but you don't need to include regions that won't contain any shadows.


First,thanks for you reply.

Yeah,you are right,i need to render the receiver into the shadow map.
But if the receiver's z is greater than 1.0,i can't render it to the shadow map.

See the picture:




The blue aabb is the boy's world space aabb,the red aabb is the boy's light space aabb.Only the green rectangle render to the shadow map(the blue rectangle in the shadow map),other part is cliped.


If i can render the part which z is greater than 1.0 to the shadow map,the result is right.

I have two method:
1.Extend the aabb to include the receiver's light space min z and max z.This method need additional calculate.
2.Use viewport.Set the viewport's maxZ to 100.0f(receiver's z won't exceed it).
I try this method,but it don't have effect.Is SetViewport don't have effect to shader?

AndyTX,do you have a better method?

Thanks.

[Edited by - ChenA on August 15, 2007 6:59:24 AM]

Share this post


Link to post
Share on other sites
Yes certainly you can't be clamping/clipping the depth values of the receiver. You need to include it properly in the projection (i.e. extend the far plane or fix your depth metric). This is the same as normal shadow maps except that you need to consider receivers as well as occluders.

Still, unless you're using fp16, constraining the depth range isn't that critical. fp32 has plenty of precision. If you're using the former, check out the recent thread on these forums for suggestions on how to get more precision if that turns out to be a problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by AndyTX
Yes certainly you can't be clamping/clipping the depth values of the receiver. You need to include it properly in the projection (i.e. extend the far plane or fix your depth metric). This is the same as normal shadow maps except that you need to consider receivers as well as occluders.

Still, unless you're using fp16, constraining the depth range isn't that critical. fp32 has plenty of precision. If you're using the former, check out the recent thread on these forums for suggestions on how to get more precision if that turns out to be a problem.


I use your method and get the right result.
Thank you for the patience to help me.
Thanks again.


Share this post


Link to post
Share on other sites
Quote:
Original post by AndyTX
This is the same as normal shadow maps except that you need to consider receivers as well as occluders.


why do we need to include receivers into the shadow map frustum for VSM only ?


Share this post


Link to post
Share on other sites
Quote:
Original post by zoret
why do we need to include receivers into the shadow map frustum for VSM only ?

Because VSM requires that you render receivers into the shadow map as well as castors for proper filtering (an object cannot be *just* a castor - the receiver of a shadow must also be represented in the filter region).

Share this post


Link to post
Share on other sites

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