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

Re: [Public WebGL] Weird alpha issue.



Things are becoming clearer to me:

destalpha?

For the images above, I chose a black/white checkerboard HTML background.

As you can see, both Chrome and Minefield produce "checkerboard
smoke"...my smoke texture is cutting a "hole" in the canvas whenever the
texture has an alpha that's >0 and <1.

But in Chrome, the black squares are tinted with the color of my texture
- so instead of being totally black, they are grey.  When I render my
full scene against a black background, that makes the smoke look fairly
white in Chrome and very dark in Minefield.

So it's looking like the way that the destination-alpha WebGL canvas is
blended onto the background is different in Chrome and Minefield.

Anyway - it's clear that I don't want destination alpha - so now I
change my code to say:

        gl = canvas.getContext ( "experimental-webgl", { antialias:
true, stencil: false, alpha: false }

* Under Chrome/Linux/64, I no longer get holes cut into my canvas.

* Under Chrome/Win7/32, I get a really weird mess in the region where my
smoke puff is rendered.  I'll post a screenshot from my Windows machine
in a few minutes.

* In Minefield, this change makes no difference under either Linux or
Windows - so evidently it ignores the "alpha: false" property and hands
me a destination alpha anyway.

So...we seem to have at least four new bugs here:

1) Why doesn't "alpha:false" work in Minefield?

2) Why doesn't "alpha:false" work in Chrome under Windows?

3) Why are Chrome and Minefield compositing dest-alpha canvasses
differently?  (I have no clue which is correct).

4) In both browsers and all OS's, the outer edges of the smoke puff
textured quads are alpha=0 - and they seem to have been 'discarded'
(they didn't write a zero alpha to the destination alpha because then
there would be square holes instead of smoke-puff-shaped holes) - which
suggests that the glAlphaTest is enabled...but I was under the
impression that this wasn't implemented in WebGL.  Failing to render
alpha=0 pixels is a huge "no-no" if people genuinely did want
destination alpha!

Argh!

  -- Steve


On 10/31/2010 12:14 PM, Steve Baker wrote:
> Holy crap!   I didn't expect *THAT*!
>
> So - I make a super-simple "test-app" version of my game (in another
> directory) and it produces white smoke where the main app generates
> dark.  Next, I start to make my test application more and more like the
> real application and the smoke stubbornly stays white (ie it looks the
> same in Chrome as it does in Minefield).
>
> Eventually, I have PRECISELY the same lines of code in the test-app and
> the real-app - the same textures, the same shaders, the same absolutely
> everything.  And they still look different!!    I have NO clue WTF is
> making these two apps different.
>
> Er...except for the HTML that hosts the web page has:
>
>    <body bgcolor="#000000">        in the 'real application'
>    <body>                                           in the 'test
> application'
>
> And lo and behold - when I change the HTML background color, the color
> of the smoke changes!  So it looks like the problem is in the
> compositing step.
>
> I kinda suspect that I'm somehow getting a "destination alpha" frame
> buffer in Minefield and no "destination alpha" in Chrome - so when I
> write my translucent polygons into the frame buffer, I'm making the
> resulting canvas have translucent bits!   Maybe that makes the
> compositor blend in the HTML page's background wherever I write my
> particles?
>
> I'm doing more experiments.  I tried taking the SDK demo program
> "sdk/demos/google/particles" and changing the HTML background to black -
> but that didn't make a difference...so it's obviously a little more
> complicated than just that.
>
> Man - it's been about a decade since I last messed with destination
> alpha!   I'm going to have to dust off my ancient copy of the "Red Book"
> and try to kick my memory into life!
>
>   -- Steve
>
> -----------------------------------------------------------
> 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:
>
>   

Attachment: destAlpha.png
Description: PNG image