From 7b108ae9a2cbc45524a86bf5d40cef34417ec357 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 19 Dec 2018 01:45:05 +0000 Subject: [PATCH] Disable depth sorting for translucent objects in the shadow maps --- components/sceneutil/mwshadowtechnique.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/sceneutil/mwshadowtechnique.cpp b/components/sceneutil/mwshadowtechnique.cpp index ea52ec24a8..6f3d34cb1a 100644 --- a/components/sceneutil/mwshadowtechnique.cpp +++ b/components/sceneutil/mwshadowtechnique.cpp @@ -1554,7 +1554,8 @@ void MWShadowTechnique::createShaders() _shadowCastingStateSet->setMode(GL_DEPTH_CLAMP, osg::StateAttribute::ON); - // TODO: figure out if there's some way to disable depth sorting for translucent objects as we don't care about blending. + _shadowCastingStateSet->setRenderBinDetails(osg::StateSet::OPAQUE_BIN, "RenderBin", osg::StateSet::OVERRIDE_PROTECTED_RENDERBIN_DETAILS); + // TODO: compare performance when alpha testing is handled here versus using a discard in the fragment shader // TODO: compare performance when we set a bunch of GL state to the default here with OVERRIDE set so that there are fewer pointless state switches }