From 90799e10da2ff09add13c9cc3f9e4d91713b1750 Mon Sep 17 00:00:00 2001 From: Phil Palmer Date: Sun, 3 Jan 2021 16:31:51 -0500 Subject: [PATCH] Fix z-write enabled for transparent draws. Fix z-write being enabled for transparencies in GeometryCache::getSimplePipeline and Procedural::Procedural (fixes https://github.com/vircadia/vircadia/issues/224). Z-write is controlled by the 'writeMask' parameter of gpu::State::setDepthTest. --- libraries/procedural/src/procedural/Procedural.cpp | 2 +- libraries/render-utils/src/GeometryCache.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/procedural/src/procedural/Procedural.cpp b/libraries/procedural/src/procedural/Procedural.cpp index 88c111f8fd..66dde1ca56 100644 --- a/libraries/procedural/src/procedural/Procedural.cpp +++ b/libraries/procedural/src/procedural/Procedural.cpp @@ -125,7 +125,7 @@ Procedural::Procedural() { opaqueStencil(_opaqueState); _transparentState->setCullMode(gpu::State::CULL_NONE); - _transparentState->setDepthTest(true, true, gpu::LESS_EQUAL); + _transparentState->setDepthTest(true, false, gpu::LESS_EQUAL); _transparentState->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index ea66ac19ec..68daba92e3 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -2207,7 +2207,7 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp } else { state->setCullMode(gpu::State::CULL_BACK); } - state->setDepthTest(true, true, gpu::LESS_EQUAL); + state->setDepthTest(true, !config.isTransparent(), gpu::LESS_EQUAL); if (config.hasDepthBias()) { state->setDepthBias(1.0f); state->setDepthBiasSlopeScale(1.0f);