Skip to content

Commit

Permalink
Merge pull request #18235 from donmccurdy/feat-gltfloader-transparent…
Browse files Browse the repository at this point in the history
…-depthwrite

GLTFLoader: Use depthWrite=false for transparent materials
  • Loading branch information
mrdoob authored Feb 22, 2020
2 parents b559213 + 21498d1 commit 421e610
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,9 @@ THREE.GLTFLoader = ( function () {

materialParams.transparent = true;

// See: https://github.com/mrdoob/three.js/issues/17706
materialParams.depthWrite = false;

} else if ( alphaMode === ALPHA_MODES.MASK ) {

materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,9 @@ var GLTFLoader = ( function () {

materialParams.transparent = true;

// See: https://github.com/mrdoob/three.js/issues/17706
materialParams.depthWrite = false;

} else if ( alphaMode === ALPHA_MODES.MASK ) {

materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
Expand Down
5 changes: 0 additions & 5 deletions examples/webgl_postprocessing_unreal_bloom.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@

scene.add( model );

// Mesh contains self-intersecting semi-transparent faces, which display
// z-fighting unless depthWrite is disabled.
var core = model.getObjectByName( 'geo1_HoloFillDark_0' );
core.material.depthWrite = false;

mixer = new THREE.AnimationMixer( model );
var clip = gltf.animations[ 0 ];
mixer.clipAction( clip.optimize() ).play();
Expand Down

0 comments on commit 421e610

Please sign in to comment.