if (!transparentDepthMask) {
gl.depthMask(false);
}
... has the wrong ! in front of it.
The semantic bug
transparentDepthMask == true should mean that it won't update Z-Buffer (it's transparent for Z-Buffer updates)
The practical bug
due to const transparentDepthMask = true;, the code will never enter the if, and this will cause transparent objects to update the Z-Buffer, leading to strange artifacts when 2 transparent objects overlap
The solution
Just change this code...
if (!transparentDepthMask) {
gl.depthMask(false);
}
... to...
if (transparentDepthMask) {
gl.depthMask(false);
}
The problem
In the following code...
https://github.com/xeokit/xeokit-sdk/blob/9c7819aae888d3f6519abf94578055b6b10a4f43/src/viewer/scene/webgl/Renderer.js#L599-L614
... seems that this if...
... has the wrong
!
in front of it.The semantic bug
transparentDepthMask == true
should mean that it won't update Z-Buffer (it's transparent for Z-Buffer updates)The practical bug
const transparentDepthMask = true;
, the code will never enter theif
, and this will cause transparent objects to update the Z-Buffer, leading to strange artifacts when 2 transparent objects overlapThe solution
Just change this code...
... to...
(notice the removed
!
)And, of course, remember to invoke...
... at the end of the
if
statement:https://github.com/xeokit/xeokit-sdk/blob/9c7819aae888d3f6519abf94578055b6b10a4f43/src/viewer/scene/webgl/Renderer.js#L599-L638