diff --git a/src/core/display/chunks/flagsChunk.js b/src/core/display/chunks/flagsChunk.js index 0f32565c..924828a6 100644 --- a/src/core/display/chunks/flagsChunk.js +++ b/src/core/display/chunks/flagsChunk.js @@ -63,7 +63,7 @@ SceneJS_ChunkFactory.createChunkType({ // Entering a transparency bin gl.enable(gl.BLEND); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); frameCtx.blendEnabled = true; } else { diff --git a/src/core/display/chunks/regionMapChunk.js b/src/core/display/chunks/regionMapChunk.js index a82795cd..a247bf5d 100644 --- a/src/core/display/chunks/regionMapChunk.js +++ b/src/core/display/chunks/regionMapChunk.js @@ -29,7 +29,7 @@ SceneJS_ChunkFactory.createChunkType({ // Entering a transparency bin gl.enable(gl.BLEND); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); frameCtx.blendEnabled = true; } else { diff --git a/src/core/display/chunks/renderTargetChunk.js b/src/core/display/chunks/renderTargetChunk.js index f940c03e..4f146c48 100644 --- a/src/core/display/chunks/renderTargetChunk.js +++ b/src/core/display/chunks/renderTargetChunk.js @@ -36,7 +36,7 @@ SceneJS_ChunkFactory.createChunkType({ // Enable blending for non-depth targets if (frameCtx.blendEnabled) { gl.enable(gl.BLEND); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); } } diff --git a/src/core/display/programSourceFactory.js b/src/core/display/programSourceFactory.js index 3ff8f8f4..55cd9ef4 100644 --- a/src/core/display/programSourceFactory.js +++ b/src/core/display/programSourceFactory.js @@ -1214,6 +1214,10 @@ var SceneJS_ProgramSourceFactory = new (function () { add("fragColor.rgb *= mix(SCENEJS_uFragmentFresnelEdgeColor.rgb, SCENEJS_uFragmentFresnelCenterColor.rgb, fragmentFresnel);"); } + if (!depthTargeting) { + add("fragColor.rgb *= fragColor.a;"); + } + add("gl_FragColor = fragColor;"); add("}");