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

[Public WebGL] Weird alpha issue.

I'm running some particle system tests - using an RGBA .png image with
fuzzy mid-grey translucent smoke puffs.  There are lots of particles
layered on top of each other.

What's odd is that the smoke puff is much lighter in color on Chrome
than it is on Minefield - even with both browsers running side-by-side
on the exact same Win7/32bit/nVidia machine displaying the exact same
scene.   Everything else in the scene looks utterly identical in the two

I'm kinda suspecting some funky thing going on with pre-multiplied
alpha.  Is someone messing with my texture?


The setup for drawing is:

   gl.enable        ( gl.DEPTH_TEST ) ;
   gl.depthMask ( false ) ;
   gl.enable        ( gl.BLEND ) ;
   gl.blendFunc  ( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA ) ;

...with everything else left at default values.

The frag shader says:

  float4 color = texture2D ( fire, UV ).rgba * (1.0-smokeAmount) +
                         texture2D (  smoke, UV ).rgba * smokeAmount ;
  color.a *= timeVaryingAlpha ;
  gl_FragColor = color ;

...and in this case, smokeAmount is 1.0 (so we should see only the smoke
map...and that works) and timeVaryingAlpha varies between 0.0 and 1.0 as
you'd expect.

My image 'onload' function says:

    gl.bindTexture          ( gl.TEXTURE_2D, texture ) ;
    gl.pixelStorei            ( gl.UNPACK_FLIP_Y_WEBGL, true);
    gl.texImage2D          ( gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA,
gl.UNSIGNED_BYTE, image ) ;
    gl.generateMipmap ( gl.TEXTURE_2D ) ;
    gl.bindTexture           ( gl.TEXTURE_2D, null ) ;

  -- 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: