diff --git a/examples/files.js b/examples/files.js index 15fff9e71ddecf..64aba13420a3e9 100644 --- a/examples/files.js +++ b/examples/files.js @@ -242,6 +242,7 @@ var files = { "webgl_simple_gi", "webgl_skinning_simple", "webgl_sprites", + "webgl_sprites_alpha", "webgl_terrain_dynamic", "webgl_test_memory", "webgl_test_memory2", diff --git a/examples/textures/sprite3.png b/examples/textures/sprite3.png new file mode 100644 index 00000000000000..ee13939e89bad1 Binary files /dev/null and b/examples/textures/sprite3.png differ diff --git a/examples/webgl_sprites_alpha.html b/examples/webgl_sprites_alpha.html new file mode 100644 index 00000000000000..bc760e4fdd1372 --- /dev/null +++ b/examples/webgl_sprites_alpha.html @@ -0,0 +1,107 @@ + + + + three.js webgl - sprites - premultiplied alpha + + + + + + + + +
+ three.js - webgl sprites alpha example - + left is without premultiplied alpha, right is with premultiplied alpha +
+ + + + + + diff --git a/src/renderers/webgl/plugins/SpritePlugin.js b/src/renderers/webgl/plugins/SpritePlugin.js index 2893e12ff81245..a33093f7ee0479 100644 --- a/src/renderers/webgl/plugins/SpritePlugin.js +++ b/src/renderers/webgl/plugins/SpritePlugin.js @@ -223,7 +223,7 @@ function SpritePlugin( renderer, sprites ) { gl.uniform1f( uniforms.rotation, material.rotation ); gl.uniform2fv( uniforms.scale, scale ); - state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); + state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha ); state.buffers.depth.setTest( material.depthTest ); state.buffers.depth.setMask( material.depthWrite );