Browse Source

Merge pull request #13415 from takahirox/GLTFExporterMetallicRoughnessTexture

GLTFExporter: Support metallicRoughnessTexture
Mr.doob 7 years ago
parent
commit
b1227ff3e5
1 changed files with 19 additions and 0 deletions
  1. 19 0
      examples/js/exporters/GLTFExporter.js

+ 19 - 0
examples/js/exporters/GLTFExporter.js

@@ -613,6 +613,25 @@ THREE.GLTFExporter.prototype = {
 
 			}
 
+			// pbrMetallicRoughness.metallicRoughnessTexture
+			if ( material.metalnessMap || material.roughnessMap ) {
+
+				if ( material.metalnessMap === material.roughnessMap ) {
+
+					gltfMaterial.pbrMetallicRoughness.metallicRoughnessTexture = {
+
+						index: processTexture( material.metalnessMap )
+
+					};
+
+				} else {
+
+					console.warn( 'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
+
+				}
+
+			}
+
 			// pbrMetallicRoughness.baseColorTexture
 			if ( material.map ) {