Transparent BitmapTexture

Software: Away3D 4.x

Dr Schizo, Newbie
Posted: 20 March 2012 05:31 PM   Total Posts: 11

Hi everybody,

Since the outer glow is not yet available on Away 3D 4.0, I decided to replace the solar system’s star by a plane.

I dynamically load a PNG, create a BitmapTexture from its BitmapData and apply it to the mesh.

// creating the sun
var plane:PlaneGeometry = new PlaneGeometry(256,256,8,8);
var 
sun:Mesh = new Mesh(plane);
scene.addChild(sun);

// loading texture
var url:String 'soleil.png';
var 
Ldr:Loader = new Loader();
Ldr.load(new URLRequest(url));
Ldr.contentLoaderInfo.addEventListener(Event.COMPLETEonComplete);
function 
onComplete(e:Event):void
{
 
var texture:BitmapTexture = new BitmapTexture(e.target.data);
 
texture_mat.texture texture;
 
sun.material texture_mat;

Unfortunately, the material is not transparent like the png.

In the attached example, you can see:
- on the top left corner: the png included in a sprite (without Away 3D)
- on the center: the mesh with the png as a texture.
As you can see, the render is quite different!

What should I do?

Thank you a lot for reading this post and maybe to answer to it.

Dr Schizo

 

File Attachments
test.zip  (File Size: 568KB - Downloads: 209)
   

Vice, Member
Posted: 20 March 2012 05:37 PM   Total Posts: 58   [ # 1 ]

you have to make BitmapData transparent and the material too. using alphathresold or alphablending.

   

Dr Schizo, Newbie
Posted: 20 March 2012 10:41 PM   Total Posts: 11   [ # 2 ]

Thank you a lot, it was the alphaBlending property:

texture_mat.alphaBlending true
   

karlperemil, Newbie
Posted: 21 March 2012 01:25 PM   Total Posts: 7   [ # 3 ]

I always get weird results using alphaThreshold. Any tips on how to get it working?

   

Vice, Member
Posted: 22 March 2012 12:09 PM   Total Posts: 58   [ # 4 ]

can you show a screenshot or project so we can see what the problem with alphaThreshold is?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X