From 0c56a58a85da34590c0925cc13f23e996d9412c7 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Sun, 22 Dec 2019 20:37:56 -0800 Subject: [PATCH] GLTFLoader: Use depthWrite=false for transparent materials --- examples/js/loaders/GLTFLoader.js | 6 +++++- examples/jsm/loaders/GLTFLoader.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index db67a6be605bba..3a56472cad9480 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -765,7 +765,8 @@ THREE.GLTFLoader = ( function () { fog: true, lights: true, opacity: params.opacity, - transparent: params.transparent + transparent: params.transparent, + depthWrite: params.depthWrite } ); material.isGLTFSpecularGlossinessMaterial = true; @@ -2203,6 +2204,9 @@ THREE.GLTFLoader = ( function () { materialParams.transparent = true; + // See: https://github.com/mrdoob/three.js/issues/17706 + materialParams.depthWrite = false; + } else { materialParams.transparent = false; diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index 8e459e5cec0a11..95984a5f3aa270 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -832,7 +832,8 @@ var GLTFLoader = ( function () { fog: true, lights: true, opacity: params.opacity, - transparent: params.transparent + transparent: params.transparent, + depthWrite: params.depthWrite } ); material.isGLTFSpecularGlossinessMaterial = true; @@ -2270,6 +2271,9 @@ var GLTFLoader = ( function () { materialParams.transparent = true; + // See: https://github.com/mrdoob/three.js/issues/17706 + materialParams.depthWrite = false; + } else { materialParams.transparent = false;