Przeglądaj źródła

GLTF Added alphaCutoff support in exporter and loader

Fernando Serrano 8 lat temu
rodzic
commit
ff4613fda5

+ 7 - 1
examples/js/exporters/GLTFExporter.js

@@ -520,7 +520,13 @@ THREE.GLTFExporter.prototype = {
 			// alphaMode
 			if ( material.transparent ) {
 
-				gltfMaterial.alphaMode = 'BLEND'; // @FIXME We should detect MASK or BLEND
+				gltfMaterial.alphaMode = 'MASK'; // @FIXME We should detect MASK or BLEND
+
+				if ( material.alphaTest !== 0.5 ) {
+
+					gltfMaterial.alphaCutoff = material.alphaTest;
+
+				}
 
 			}
 

+ 2 - 0
examples/js/loaders/GLTFLoader.js

@@ -1603,6 +1603,8 @@ THREE.GLTFLoader = ( function () {
 
 				materialParams.transparent = true;
 
+				materialParams.alphaTest = material.alphaCutoff || 0.5;
+
 			} else {
 
 				materialParams.transparent = false;