I wanted to try HlmsDatablock::setAlphaHashing
. The documentation says to set it up like this:
Code: Select all
// Disable alpha test (default)
datablock->setAlphaTest( CMPF_ALWAYS_PASS );
// Do NOT enable alpha blending in the HlmsBlendblock (default)
HlmsBlendblock blendblock;
blendblock.setBlendType( SBT_REPLACE );
datablock->setBlendblock( &blendblock );
datablock->setAlphaHashing( true );
That's not quite correct, as one must use the pass by reference version of setBlendblock
in order to set a blend block on the stack. But more importantly, I don't know exactly how to specify the transparency value with HlmsPbsDatablock::setTransparency
. I tried this:
Code: Select all
block->setAlphaTest( Ogre::CMPF_ALWAYS_PASS );
Ogre::HlmsBlendblock blendblock;
blendblock.setBlendType( Ogre::SBT_REPLACE );
block->setBlendblock( blendblock );
pbsBlock->setTransparency( 0.5f, Ogre::HlmsPbsDatablock::Transparent,
false, false );
block->setAlphaHashing( true );
Then the log shows a bunch of warnings like this
Code: Select all
WARNING: PBS Datablock 'DebugCube' enabling transparency but forcing a blendblock to avoid alpha blending. Results may not look as expected.
followed by a pixel shader compile error:
Code: Select all
Metal SL Compiler Error in 100000000PixelShader_ps:
program_source:465:50: error: expected ')'
if( AlphaHashReject( finalAlpha, inPs.uv0.xy ALPHA_HASHING_ARG ) )
^
If I pass the mode None
instead of Transparent
, I don't get the warnings but still get the shader compile error.