Sign in to follow this  

Shadow Map gradients in Forward+ lighting loop

This topic is 679 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'm experimenting with a forward+ rendering setup, where I loop over a list of lights to apply in the pixel shader.  If a given light has shadows enabled, I sample the shadow map for that light directly in the loop.  I'd like to use EVSM shadow maps with anisotropic filtering, so I need the ddx/ddy of the texture sample position.

 

I'm thinking I can compute ddx/ddy of the world position outside the lighting loop, and then transform these derivatives into shadow map space using shadow matrix for each light.  This seems like it would work, but might be expensive.  Are there any other/better tricks for getting approximate derivatives to use?

Share this post


Link to post
Share on other sites

Awesome, thanks.

 

Follow up question, what about applying shadow in a deferred pass?  In this case, I would be reconstructing world position from depth buffer, and then use that position to look up shadow map.  This will mostly work, except the derivatives will be discontinuous on object edges in the depth buffer.

 

Googling around, the only real solutions I could find were to clamp the maximum mip level to minimize the problem, or remove mips all together.  Is there any better technique to handle this case?

Share this post


Link to post
Share on other sites

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