Browse Source

Fix blending equation in SSAARenderPass (#25089)

Skillbert 2 years ago
parent
commit
63d29bcfe6
1 changed files with 13 additions and 3 deletions
  1. 13 3
      examples/jsm/postprocessing/SSAARenderPass.js

+ 13 - 3
examples/jsm/postprocessing/SSAARenderPass.js

@@ -1,5 +1,8 @@
 import {
 import {
-	AdditiveBlending,
+	CustomBlending,
+	OneFactor,
+	AddEquation,
+	SrcAlphaFactor,
 	Color,
 	Color,
 	ShaderMaterial,
 	ShaderMaterial,
 	UniformsUtils,
 	UniformsUtils,
@@ -43,9 +46,16 @@ class SSAARenderPass extends Pass {
 			vertexShader: copyShader.vertexShader,
 			vertexShader: copyShader.vertexShader,
 			fragmentShader: copyShader.fragmentShader,
 			fragmentShader: copyShader.fragmentShader,
 			transparent: true,
 			transparent: true,
-			blending: AdditiveBlending,
 			depthTest: false,
 			depthTest: false,
-			depthWrite: false
+			depthWrite: false,
+
+			// do not use AdditiveBlending because it mixes the alpha channel instead of adding
+			blending: CustomBlending,
+			blendEquation: AddEquation,
+			blendDst: OneFactor,
+			blendDstAlpha: OneFactor,
+			blendSrc: SrcAlphaFactor,
+			blendSrcAlpha: OneFactor
 		} );
 		} );
 
 
 		this.fsQuad = new FullScreenQuad( this.copyMaterial );
 		this.fsQuad = new FullScreenQuad( this.copyMaterial );