Alpha channel in a Movie Material?

Software: Away3D 4.x

julespong, Member
Posted: 20 August 2011 01:09 AM   Total Posts: 53

What approach should I be using to respect the alpha channel in a video I’m using as the source of a VideoMaterial? My VideoMaterial seems to show all the frames of my video at once. And doesn’t seem to respect the alpha channel either. I’m using an FLV.

   

Richard Olsson, Administrator
Posted: 20 August 2011 01:16 PM   Total Posts: 1192   [ # 1 ]

The issue with showing all the frames is likely a bug in the VideoMaterial. The issue of not respecting the alpha channel is likely that you haven’t set alphaBlending = true, or alphaThreshold to some other value than zero.

Please file a bug at GitHub concerning the issue of all frames being shown at once (not clearing between draws.)

   

Jarzac, Newbie
Posted: 20 October 2011 06:39 PM   Total Posts: 6   [ # 2 ]

Hello,

This is my first post, my apologies if I don’t have the time to introduce myself.
I encountered this error and did a slight modification inside the Away3D source.

In the VideoMaterial class, inside the update() function, add these lines :
  var rect:Rectangle = new Rectangle(0, 0, 255, 255);
  bitmapData.fillRect(rect,0x00000000);
So it will clean the bitmapData background before redrawing. I don’t think it is a clean solution, but it is a working workaround :

The full function is :
public function update():void
  {
 
  if(_player.playing && !_player.paused)
  {
 
  bitmapData.lock();
  var rect:Rectangle = new Rectangle(0, 0, 255, 255);
  bitmapData.fillRect(rect,0x00000000);
  bitmapData.draw( _player.container, null, null, null, _clippingRect);
  updateTexture();
  bitmapData.unlock();
 
  }
 
  }

I am sorry for the pieces of code, I would have post this on github but I didn’t find how to register.

Related to github bug #54 :
https://github.com/away3d/away3d-core-fp11/issues/54

Hope it will help you to correct this issue.

Best,

   

Jarzac, Newbie
Posted: 08 November 2011 05:15 PM   Total Posts: 6   [ # 3 ]

Hello,

My bad about this I just notice it was dumb not to use the _clippingRect :
  public function update():void
  {
 
  if(_player.playing && !_player.paused)
  {
 
  bitmapData.lock();
  bitmapData.fillRect(_clippingRect,0x00000000);
  bitmapData.draw( _player.container, null, null, null, _clippingRect);
  updateTexture();
  bitmapData.unlock();
 
  }
 
  }

Best,

   

RiaanWest, Newbie
Posted: 23 February 2012 03:39 PM   Total Posts: 3   [ # 4 ]

Thanks Jarzac, your solution works perfectly!

Happiness!

   

Jarzac, Newbie
Posted: 23 February 2012 04:13 PM   Total Posts: 6   [ # 5 ]

You are welcome smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X