Skip to content

Commit

Permalink
GLTFLoader: Use depthWrite=false for transparent materials
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Dec 23, 2019
1 parent 9ee686c commit 0c56a58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0c56a58

Please sign in to comment.