Permalink
Browse files

Merge remote-tracking branch 'kovleouf/dev' into dev

  • Loading branch information...
2 parents c1b59c0 + f3d2d48 commit 22419675e69257dc1424fe34f61e52c6065f5962 @mrdoob committed Feb 20, 2012
Showing with 9 additions and 2 deletions.
  1. +1 −0 src/materials/Material.js
  2. +8 −2 src/renderers/WebGLRenderer.js
View
1 src/materials/Material.js
@@ -43,3 +43,4 @@ THREE.AdditiveBlending = 1;
THREE.SubtractiveBlending = 2;
THREE.MultiplyBlending = 3;
THREE.AdditiveAlphaBlending = 4;
+THREE.NoBlending = 5;
View
10 src/renderers/WebGLRenderer.js
@@ -5175,8 +5175,13 @@ THREE.WebGLRenderer = function ( parameters ) {
switch ( blending ) {
+ case THREE.NoBlending:
+ _gl.disable( _gl.BLEND );
+ break;
+
case THREE.AdditiveBlending:
+ _gl.enable( _gl.BLEND );
_gl.blendEquation( _gl.FUNC_ADD );
_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE );
@@ -5185,7 +5190,7 @@ THREE.WebGLRenderer = function ( parameters ) {
case THREE.SubtractiveBlending:
// TODO: Find blendFuncSeparate() combination
-
+ _gl.enable( _gl.BLEND );
_gl.blendEquation( _gl.FUNC_ADD );
_gl.blendFunc( _gl.ZERO, _gl.ONE_MINUS_SRC_COLOR );
@@ -5194,14 +5199,15 @@ THREE.WebGLRenderer = function ( parameters ) {
case THREE.MultiplyBlending:
// TODO: Find blendFuncSeparate() combination
-
+ _gl.enable( _gl.BLEND );
_gl.blendEquation( _gl.FUNC_ADD );
_gl.blendFunc( _gl.ZERO, _gl.SRC_COLOR );
break;
default:
+ _gl.enable( _gl.BLEND );
_gl.blendEquationSeparate( _gl.FUNC_ADD, _gl.FUNC_ADD );
_gl.blendFuncSeparate( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );

4 comments on commit 2241967

@alteredq

This commit (or something closely related) broke stuff.

I need to investigate more, just heads up to warn others, if somebody started to have weird behaviors recently (for me it's SSAO not working at all and strange behaviors for transparent textures generated with render targets).

Took me a while to realize problems are related to this :S.

@mrdoob
Owner

May it also be with clearColor? :S

@alteredq

It's possible. Did you also observe something strange?

For example I got unexpected clear color baked into procedurally generated transparent texture (when doing this asynchronously in callback instead of in usual render loop).

Meanwhile at least I solved SSAO mystery ;)

I was messing with blending state manually and this new blending handling kept overriding my manual state. Solution was to use instead this brand new THREE.NoBlending type.

@mrdoob
Owner

Yup. I remember dealing with shadow texture in the icosahedron vertex color examples not appearing when WebGLRenderer had (or didn't have) a clearColor.

Please sign in to comment.