Sign in to follow this  
Alundra

SDSM : Lamba and minimum distance

Recommended Posts

Hi,
SDSM is a good improvement on the shadow quality.
You find the min and max distance from the depth buffer.
You then compute the split like that :

const float Lambda = 0.5f;
const UInt32 NumCascades = 4;
const float ClipRange = CameraComponent->GetFarClipPlane() - CameraComponent->GetNearClipPlane();
m_CascadeSplitArray[ 0 ] = MinDistance * ClipRange;
m_CascadeSplitArray[ NumCascades ] = MaxDistance * ClipRange;
const float Range = m_CascadeSplitArray[ NumCascades ] - m_CascadeSplitArray[ 0 ];
const float Ratio = m_CascadeSplitArray[ NumCascades ] / m_CascadeSplitArray[ 0 ];
for( UInt32 Split = 1; Split < NumCascades; ++Split )
{
  const float p = static_cast< float >( Split ) / static_cast< float >( NumCascades );
  const float Log = m_CascadeSplitArray[ 0 ] * CMath::Pow( Ratio, p );
  const float Uniform = m_CascadeSplitArray[ 0 ] + ( Range * p );
  m_CascadeSplitArray[ Split ] = Lambda * ( Log - Uniform ) + Uniform;
}

I use a Lamba of 0.5f but is it needed to set this value in the scene properties ?
Another issue is when you are very near from a geometry then you got this issue :
s8d9.png
The only solution is to have a property to set a minimum on the range of the min/max from the SDSM pass ?
Thanks

Edited by Alundra

Share this post


Link to post
Share on other sites

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