Просмотр исходного кода

Examples: Fix opacity in copy and blend shaders. (#23671)

Michael Herzog 3 лет назад
Родитель
Сommit
8904a38567

+ 0 - 1
examples/jsm/postprocessing/SSAARenderPass.js

@@ -44,7 +44,6 @@ class SSAARenderPass extends Pass {
 			uniforms: this.copyUniforms,
 			vertexShader: copyShader.vertexShader,
 			fragmentShader: copyShader.fragmentShader,
-			premultipliedAlpha: true,
 			transparent: true,
 			blending: AdditiveBlending,
 			depthTest: false,

+ 2 - 1
examples/jsm/shaders/BlendShader.js

@@ -38,7 +38,8 @@ const BlendShader = {
 
 			vec4 texel1 = texture2D( tDiffuse1, vUv );
 			vec4 texel2 = texture2D( tDiffuse2, vUv );
-			gl_FragColor = opacity * mix( texel1, texel2, mixRatio );
+			gl_FragColor = mix( texel1, texel2, mixRatio );
+			gl_FragColor.a *= opacity;
 
 		}`
 

+ 3 - 2
examples/jsm/shaders/CopyShader.js

@@ -32,8 +32,9 @@ const CopyShader = {
 
 		void main() {
 
-			vec4 texel = texture2D( tDiffuse, vUv );
-			gl_FragColor = opacity * texel;
+			gl_FragColor = texture2D( tDiffuse, vUv );
+			gl_FragColor.a *= opacity;
+
 
 		}`