Skip to content

Commit

Permalink
#6081: Even if a material defines just a single specular, this will s…
Browse files Browse the repository at this point in the history
…till count as interaction pass with a _black diffuse and a _flat bump.

Run the depth fill pass for such materials and make sure it doesn't crash due to the lacking diffuse stage.
  • Loading branch information
codereader committed Sep 4, 2022
1 parent 1626bdf commit 3ac8846
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions radiantcore/rendersystem/backend/OpenGLShader.cpp
Expand Up @@ -549,15 +549,14 @@ void OpenGLShader::constructLightingPassesFromMaterial()

if (!interactionLayers.empty())
{
if (diffuseForDepthFillPass)
{
// Create depth-buffer fill pass, possibly with alpha test
auto& zPass = appendDepthFillPass();

zPass.stage0 = diffuseForDepthFillPass;
zPass.texture0 = getTextureOrInteractionDefault(diffuseForDepthFillPass)->getGLTexNum();
zPass.alphaThreshold = diffuseForDepthFillPass->getAlphaTest();
}
// Create depth-buffer fill pass, possibly with alpha test
auto& zPass = appendDepthFillPass();

zPass.stage0 = diffuseForDepthFillPass;
zPass.texture0 = diffuseForDepthFillPass ?
getTextureOrInteractionDefault(diffuseForDepthFillPass)->getGLTexNum() :
getDefaultInteractionTexture(IShaderLayer::DIFFUSE)->getGLTexNum();
zPass.alphaThreshold = diffuseForDepthFillPass ? diffuseForDepthFillPass->getAlphaTest() : -1.0f;

appendInteractionPass(interactionLayers);
}
Expand Down

0 comments on commit 3ac8846

Please sign in to comment.