Skip to content

Unpack premultiplied alpha? #6

@deathcap

Description

@deathcap

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions