[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Weird alpha issue.

According to the spec, (forgive me if I misread it) - WebGL doesn't
support the glAlphaFunc feature from OpenGL.  (I think that's because
it's not implemented in OpenGL ES 2.0)   So if you want something like
the OpenGL alpha test feature, you have to implement it yourself in your
shader using:

    if ( alpha < alphaRef ) discard ;

Well, my example program doesn't do that - hence, pixels with alpha==0.0
*SHOULD* be rendered just like pixels with (say) alpha==0.1 are.


So - look at my little test program:  The smoke puff is a pair of
triangles with a texture that has alpha==1.0 in the middle and
alpha==0.0 at the edges.  So when destination alpha is enabled (either
deliberately or buggily) we should see a rectangular hole in the canvas
- not a smoke-cloud-shaped hole.  Even if destination-alpha were
disabled, this behavior would cause unexpected issues with Z-buffering
of completely transparent surfaces.

The behavior I'm seeing is as if alpha testing were enabled with
alphaRef set to some very small value.

It should be an easy fix - just call glDisable(GL_ALPHA_TEST)
someplace.  What's weird is that should be the OpenGL default - so
something somewhere is actively calling glEnable(GL_ALPHA_TEST)...and it

AFAICT, neither Minefield nor Chrome is getting that right - not in
OpenGL or ANGLE - Linux or Windows.

The way things are right now, if someone actually WANTED to cut a
perfectly transparent shape out of their destination-alpha canvas,
they'd be unable to do so by writing alpha==0 pixels.

  -- Steve

On 11/01/2010 03:44 PM, Benoit Jacob wrote:
>> * Both browsers incorrectly AlphaTest out pixels where alpha==0.0
> Sorry, I missed this part and can't find back where you explained it. What are we doing wrong specifically on pixels where alpha==0 ?
> Benoit

You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: