Closed ramsestom closed 8 years ago
Texture transparency is (or at least should be supported) by Away3D. There are in fact two types of transparency supported.
Firstly, full transparency is supported by enabling alphaBlending on the TextureMaterial object.
textureMaterial.alphaBlending = true;
This mode allows all levels of alpha transparency to be shown however can lead to depth sorting issues in some circumstances.
The second method solves the depth sorting issues at the sacrifice of multiple levels of alpha. In this case, setting the alphaThreshold (value 0.0 -> 1.0) means that any pixel value in the texture that has an alpha value > that the alphaThreshold will be visible.
textureMaterial.alphaThreshold = 0.8;
This will show only pixel values where their alpha is 0.8 or above, all other pixels will be completely transparent.
Can you test either/both of these settings to ensure the alpha is coming through correctly for your situation. If so, this issue can be closed, otherwise, if you could add a code snippet and maybe the image I can look into it.
Hi greg Thanks for the quick answer. Actually it appear my issue is related to a bug in the bitamapdata.draw() function in openfl when targetting windows. I checked the transparency of my bitmapdata when displayed in a simple sprite with flash but forgot to check it when switching to windows target and it appear on this target, there isn't the expected transparency in my bitmapdata... Sorry. I will post the issue on the openfl forum but away3D is probably handeling texture transparency correctly indeed ;)
I have a texture which I applied to a plan in which I have to make a "hole". For this, I tried to set the alpha value of the pixels of the bitmapdata of my texture to 0 at the position of the hole but, when applied as a texture, the alpha transparency seems to be ignored. If I just display the bitmapdata out of away3D (in a simple openfl sprite), it is correct, the pixels of the hole have an alpha of 0 and appear as transparent. But when applied to an away3D plan as a texture, these pixels appear completely opaque (like if they had an alpha of 1). So is this a bug or aren't textures supposed to handle transparency?