PSSM Shadow Fix

fixes the issue with pssm shadows were the softness value makes the shadow cast on the entire cascade.
This commit is contained in:
marauder2k7 2026-03-12 20:47:19 +00:00
parent 058983aa42
commit 6a8d832bd6
3 changed files with 143 additions and 98 deletions

View file

@ -112,6 +112,18 @@ void ShadowMaterialHook::init( BaseMatInstance *inMat )
mShadowMat[ShadowType_Spot] = newMat;
newMat = new ShadowMatInstance(shadowMat);
newMat->setUserObject(inMat->getUserObject());
newMat->getFeaturesDelegate().bind(&ShadowMaterialHook::_overrideFeatures);
forced.setCullMode(GFXCullCW);
forced.zBias = 1000.0f;
forced.zSlopeBias = 1.0f;
forced.setFillModeSolid();
newMat->addStateBlockDesc(forced);
forced.cullDefined = true;
newMat->init(features, inMat->getVertexFormat());
mShadowMat[ShadowType_PSSM] = newMat;
newMat = new ShadowMatInstance( shadowMat );
newMat->setUserObject( inMat->getUserObject() );
newMat->getFeaturesDelegate().bind( &ShadowMaterialHook::_overrideFeatures );
@ -162,12 +174,6 @@ BaseMatInstance* ShadowMaterialHook::getShadowMat( ShadowType type ) const
{
AssertFatal( type < ShadowType_Count, "ShadowMaterialHook::getShadowMat() - Bad light type!" );
// The cubemap and pssm shadows use the same
// spotlight material for shadows.
if ( type == ShadowType_Spot ||
type == ShadowType_PSSM )
return mShadowMat[ShadowType_Spot];
// Get the specialized shadow material.
return mShadowMat[type];
}