basic textureMaterial with png texture - setting alphathreshold adds black/dark halo over image

Software: Away3D 4.x

beers, Member
Posted: 28 March 2014 05:32 AM   Total Posts: 53

setting alphapremultiplied to true or false does nothing to fix the problem.

It looks like the texture is being premultiplied by its alpha. Ive read reports that this is an adobe bug with the png format in stage3d.

Has this not been fixed? This basically makes using alphathreshold useless since it darkens the texture. You really notice it if your texture uses a distance field alphamap.



beers, Member
Posted: 28 March 2014 05:26 PM   Total Posts: 53   [ # 1 ]

Ok this doesnt appear to be only a png issue. I think theres something wrong with the way away3d processes the alpha channel in an image. It seems to multiply it with the color.

As a test I switched from using 1 png to 2 jpgs (one jpg color - the other a b&w to be used as the alpha - then used bitmapData copychannel to merge the b&w into the alpha of the color image).

This still produces the black darkened/halo over the image when using alphaThreshold. Again, setting alphaPremultiplied doesnt do anything to fix the problem.

I cant believe no one has reported this bug before?


beers, Member
Posted: 29 March 2014 08:30 PM   Total Posts: 53   [ # 2 ]

Further testing and I have found the bug:

in alphaPremultiplied only works if alphaBlending is true. But if you only want to use alphaThreshold (and NOT alphaBlending), alphaPremultiplied is ignored, and thus the resulting black halo over the image onscreen.

So the fix is: the alphaPremultiplied code needs to be run if either alphaBlending is true, or alphaThreshold is true (>0).

Hope this makes it into a future release, as it needs to be fixed.



Away3D Forum

Member Login