diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index f90b9e1c3bb186..40f1ce6ce90085 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -2885,7 +2885,6 @@ } else { materialParams.transparent = false; - materialParams.alphaWrite = false; if ( alphaMode === ALPHA_MODES.MASK ) { diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index aa5f60a1bed23c..f71bda96aba7c6 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -3178,7 +3178,6 @@ class GLTFParser { } else { materialParams.transparent = false; - materialParams.alphaWrite = false; if ( alphaMode === ALPHA_MODES.MASK ) { diff --git a/src/loaders/MaterialLoader.js b/src/loaders/MaterialLoader.js index 2af3967528bfc6..97571fde5280dd 100644 --- a/src/loaders/MaterialLoader.js +++ b/src/loaders/MaterialLoader.js @@ -100,7 +100,6 @@ class MaterialLoader extends Loader { if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite; if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite; - if ( json.alphaWrite !== undefined ) material.alphaWrite = json.alphaWrite; if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite; if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask; diff --git a/src/materials/Material.js b/src/materials/Material.js index 420ce960c9322c..9c118f8abc0020 100644 --- a/src/materials/Material.js +++ b/src/materials/Material.js @@ -53,7 +53,6 @@ class Material extends EventDispatcher { this.shadowSide = null; this.colorWrite = true; - this.alphaWrite = true; this.precision = null; // override the renderer's default precision for this material @@ -312,7 +311,6 @@ class Material extends EventDispatcher { data.depthTest = this.depthTest; data.depthWrite = this.depthWrite; data.colorWrite = this.colorWrite; - data.alphaWrite = this.alphaWrite; data.stencilWrite = this.stencilWrite; data.stencilWriteMask = this.stencilWriteMask; @@ -448,7 +446,6 @@ class Material extends EventDispatcher { this.shadowSide = source.shadowSide; this.colorWrite = source.colorWrite; - this.alphaWrite = source.alphaWrite; this.precision = source.precision; diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js index 88965b4e00cb23..1842833d90b612 100644 --- a/src/renderers/webgl/WebGLProgram.js +++ b/src/renderers/webgl/WebGLProgram.js @@ -654,7 +654,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) { ( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '', parameters.dithering ? '#define DITHERING' : '', - parameters.alphaWrite ? '' : '#define OPAQUE', + parameters.transparent ? '' : '#define OPAQUE', ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ), diff --git a/src/renderers/webgl/WebGLPrograms.js b/src/renderers/webgl/WebGLPrograms.js index bcadf4d763c528..714b25ad42941e 100644 --- a/src/renderers/webgl/WebGLPrograms.js +++ b/src/renderers/webgl/WebGLPrograms.js @@ -176,9 +176,10 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities specularIntensityMap: !! material.specularIntensityMap, specularColorMap: !! material.specularColorMap, + transparent: material.transparent, + alphaMap: !! material.alphaMap, alphaTest: useAlphaTest, - alphaWrite: material.alphaWrite || material.transparent, gradientMap: !! material.gradientMap, @@ -325,7 +326,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities array.push( parameters.toneMapping ); array.push( parameters.numClippingPlanes ); array.push( parameters.numClipIntersection ); - array.push( parameters.alphaWrite ); } @@ -447,6 +447,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities _programLayers.enable( 21 ); if ( parameters.decodeVideoTexture ) _programLayers.enable( 22 ); + if ( parameters.transparent ) + _programLayers.enable( 23 ); array.push( _programLayers.mask );