mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-05-17 19:26:43 +00:00
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:
parent
058983aa42
commit
6a8d832bd6
3 changed files with 143 additions and 98 deletions
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue