Proper blending modes for handling alpha test

This commit is contained in:
Jack Andersen 2019-03-02 20:17:41 -10:00
parent 1f04f7ae12
commit 927be4e839
6 changed files with 9 additions and 7 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit 66cf60ea558d62353fb48c753710ff84c948b013
Subproject commit af5024014394ad5457280060a3055dab041927a2

@ -1 +1 @@
Subproject commit b3bbfee51d3f01debbb6b09cbf80897c31f135c1
Subproject commit 96c520ed950682d113953f570fbd10a485cc0e8a

View File

@ -259,8 +259,10 @@ inline boo::AdditionalPipelineInfo ShaderTag::additionalInfo(const ExtensionSlot
break;
}
return {boo::BlendFactor((ext.srcFactor == BlendFactor::Original) ? blendFactors.first : ext.srcFactor),
boo::BlendFactor((ext.dstFactor == BlendFactor::Original) ? blendFactors.second : ext.dstFactor),
BlendFactor srcFactor = m_alphaTest ? BlendFactor::One : blendFactors.first;
BlendFactor dstFactor = m_alphaTest ? BlendFactor::Zero : blendFactors.second;
return {boo::BlendFactor((ext.srcFactor == BlendFactor::Original) ? srcFactor : ext.srcFactor),
boo::BlendFactor((ext.dstFactor == BlendFactor::Original) ? dstFactor : ext.dstFactor),
getPrimType(),
zTest,
ext.noDepthWrite ? false : getDepthWrite(),

View File

@ -127,7 +127,7 @@ std::string GLSL::GenerateVertUniformStruct(unsigned skinSlots, bool reflectionC
}
std::string GLSL::GenerateAlphaTest() const {
return " if (colorOut.a < 0.01)\n"
return " if (colorOut.a < 0.25)\n"
" {\n"
" discard;\n"
" }\n";

View File

@ -123,7 +123,7 @@ std::string HLSL::GenerateVertUniformStruct(unsigned skinSlots, bool reflectionC
}
std::string HLSL::GenerateAlphaTest() const {
return " if (colorOut.a < 0.01)\n"
return " if (colorOut.a < 0.25)\n"
" {\n"
" discard;\n"
" }\n";

View File

@ -123,7 +123,7 @@ std::string Metal::GenerateFragOutStruct() const {
}
std::string Metal::GenerateAlphaTest() const {
return " if (out.color.a < 0.01)\n"
return " if (out.color.a < 0.25)\n"
" {\n"
" discard_fragment();\n"
" }\n";