From 71ec3b2ea2409a00c946f5d6aa22fe9babace96d Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 4 Sep 2019 21:38:08 -0700 Subject: [PATCH] GLTFExporter: Fixed alphaMode handling --- examples/js/exporters/GLTFExporter.js | 10 ++++++---- examples/jsm/exporters/GLTFExporter.js | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/js/exporters/GLTFExporter.js b/examples/js/exporters/GLTFExporter.js index a2f37404f21770..5cbb3eaf1a1e0d 100644 --- a/examples/js/exporters/GLTFExporter.js +++ b/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; } diff --git a/examples/jsm/exporters/GLTFExporter.js b/examples/jsm/exporters/GLTFExporter.js index 7fa3dc28cbfd60..7aa28926820a6b 100644 --- a/examples/jsm/exporters/GLTFExporter.js +++ b/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; }