Browse Source

GLTFExporter: Fixed alphaMode handling

Mr.doob 5 years ago
parent
commit
71ec3b2ea2
2 changed files with 12 additions and 8 deletions
  1. 6 4
      examples/js/exporters/GLTFExporter.js
  2. 6 4
      examples/jsm/exporters/GLTFExporter.js

+ 6 - 4
examples/js/exporters/GLTFExporter.js

@@ -1088,13 +1088,15 @@ THREE.GLTFExporter.prototype = {
 			}
 
 			// alphaMode
-			if ( material.transparent || material.alphaTest > 0.0 ) {
+			if ( material.transparent ) {
 
-				gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK';
+				gltfMaterial.alphaMode = 'BLEND';
 
-				// Write alphaCutoff if it's non-zero and different from the default (0.5).
-				if ( material.alphaTest > 0.0 && material.alphaTest !== 0.5 ) {
+			} else {
+
+				if ( material.alphaTest > 0.0 ) {
 
+					gltfMaterial.alphaMode = 'MASK';
 					gltfMaterial.alphaCutoff = material.alphaTest;
 
 				}

+ 6 - 4
examples/jsm/exporters/GLTFExporter.js

@@ -1112,13 +1112,15 @@ GLTFExporter.prototype = {
 			}
 
 			// alphaMode
-			if ( material.transparent || material.alphaTest > 0.0 ) {
+			if ( material.transparent ) {
 
-				gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK';
+				gltfMaterial.alphaMode = 'BLEND';
 
-				// Write alphaCutoff if it's non-zero and different from the default (0.5).
-				if ( material.alphaTest > 0.0 && material.alphaTest !== 0.5 ) {
+			} else {
+
+				if ( material.alphaTest > 0.0 ) {
 
+					gltfMaterial.alphaMode = 'MASK';
 					gltfMaterial.alphaCutoff = material.alphaTest;
 
 				}