Browse Source

WebGLRenderer: Fix alpha map rendering for points and sprites. (#26128)

Michael Herzog 2 years ago
parent
commit
a86fa2cf8b
2 changed files with 6 additions and 0 deletions
  1. 2 0
      src/renderers/shaders/UniformsLib.js
  2. 4 0
      src/renderers/webgl/WebGLMaterials.js

+ 2 - 0
src/renderers/shaders/UniformsLib.js

@@ -205,6 +205,7 @@ const UniformsLib = {
 		scale: { value: 1.0 },
 		map: { value: null },
 		alphaMap: { value: null },
+		alphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },
 		alphaTest: { value: 0 },
 		uvTransform: { value: /*@__PURE__*/ new Matrix3() }
 
@@ -219,6 +220,7 @@ const UniformsLib = {
 		map: { value: null },
 		mapTransform: { value: /*@__PURE__*/ new Matrix3() },
 		alphaMap: { value: null },
+		alphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },
 		alphaTest: { value: 0 }
 
 	}

+ 4 - 0
src/renderers/webgl/WebGLMaterials.js

@@ -289,6 +289,8 @@ function WebGLMaterials( renderer, properties ) {
 
 			uniforms.alphaMap.value = material.alphaMap;
 
+			refreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );
+
 		}
 
 		if ( material.alphaTest > 0 ) {
@@ -317,6 +319,8 @@ function WebGLMaterials( renderer, properties ) {
 
 			uniforms.alphaMap.value = material.alphaMap;
 
+			refreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );
+
 		}
 
 		if ( material.alphaTest > 0 ) {