Skip to content

Commit

Permalink
[Regression] Broken Blending during shadow caster passes
Browse files Browse the repository at this point in the history
Fix setupSharedBasicProperties setting wrong properties for shadow
casters.

Thanks Eugene for everything!

Bug was introduced in 188068f
  • Loading branch information
darksylinc committed Aug 23, 2024
1 parent db29ca5 commit 9df4a3f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ namespace Ogre
}
}

setupSharedBasicProperties( renderable );
setupSharedBasicProperties( renderable, true );

if( hasAlphaTestOrHash && getProperty( kNoTid, PbsProperty::UseTextureAlpha ) )
{
Expand Down
2 changes: 1 addition & 1 deletion Components/Hlms/Unlit/src/OgreHlmsUnlit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ namespace Ogre
inOutPieces[PixelShader] = normalPassPieces[PixelShader];
}

setupSharedBasicProperties( renderable );
setupSharedBasicProperties( renderable, true );

if( mFastShaderBuildHack )
setProperty( kNoTid, UnlitProperty::MaterialsPerBuffer, static_cast<int>( 2 ) );
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreHlms.h
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ namespace Ogre
static bool findParamInVec( const HlmsParamVec &paramVec, IdString key, String &inOut );

protected:
void setupSharedBasicProperties( Renderable *renderable );
void setupSharedBasicProperties( Renderable *renderable, const bool bCasterPass );

public:
/** Called by the renderable when either it changes the material,
Expand Down
8 changes: 4 additions & 4 deletions OgreMain/src/OgreHlms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,7 @@ namespace Ogre
}
}
//-----------------------------------------------------------------------------------
void Hlms::setupSharedBasicProperties( Renderable *renderable )
void Hlms::setupSharedBasicProperties( Renderable *renderable, const bool bCasterPass )
{
HlmsDatablock *datablock = renderable->getDatablock();

Expand All @@ -2779,9 +2779,9 @@ namespace Ogre
setProperty( kNoTid, HlmsBaseProp::AlphaTestShadowCasterOnly,
datablock->getAlphaTestShadowCasterOnly() );
setProperty( kNoTid, HlmsBaseProp::AlphaBlend,
datablock->getBlendblock( false )->isAutoTransparent() );
datablock->getBlendblock( bCasterPass )->isAutoTransparent() );
setProperty( kNoTid, HlmsBaseProp::AlphaToCoverage,
datablock->getBlendblock( false )->mAlphaToCoverage );
datablock->getBlendblock( bCasterPass )->mAlphaToCoverage );
if( datablock->getAlphaHashing() )
setProperty( kNoTid, HlmsBaseProp::AlphaHash, 1 );

Expand Down Expand Up @@ -2857,7 +2857,7 @@ namespace Ogre

setProperty( kNoTid, HlmsBaseProp::UvCount, numTexCoords );

setupSharedBasicProperties( renderable );
setupSharedBasicProperties( renderable, false );

HlmsDatablock *datablock = renderable->getDatablock();

Expand Down

1 comment on commit 9df4a3f

@dyunchik
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for quick fix!

Please sign in to comment.