xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
715 stars 286 forks source link

[with solution]: problem with transparent objects #267

Closed tmarti closed 4 years ago

tmarti commented 4 years ago

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...

if (!transparentDepthMask) {
    gl.depthMask(false);
}

... has the wrong ! in front of it.

The semantic bug

The practical bug

The solution

Just change this code...

if (!transparentDepthMask) {
    gl.depthMask(false);
}

... to...

if (transparentDepthMask) {
    gl.depthMask(false);
}

(notice the removed !)

And, of course, remember to invoke...

gl.depthMask(true)

... at the end of the if statement:

https://github.com/xeokit/xeokit-sdk/blob/9c7819aae888d3f6519abf94578055b6b10a4f43/src/viewer/scene/webgl/Renderer.js#L599-L638

xeolabs commented 4 years ago

Fixed in 4b85198cbee8b087341e39a26abb124e3b76f9a4