Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpack premultiplied alpha? #6

Open
deathcap opened this issue Jun 14, 2014 · 0 comments
Open

Unpack premultiplied alpha? #6

deathcap opened this issue Jun 14, 2014 · 0 comments

Comments

@deathcap
Copy link
Member

Consider enabling premultiplied alpha unpacking before loading the texture atlas into WebGL:

gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true)

This has many advantages:

https://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BPremultiplied%20alpha%5D%5D
http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx
http://kriscg.blogspot.co.uk/2009/11/premultiplied-alpha.html
http://stackoverflow.com/questions/11521035/blending-with-html-background-in-webgl

but the blending function in voxel-shader may also have to change:

gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA)

also see:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant