Alphablending in loaded 3ds models

Software: Away3D 4.x

_kihu, Jr. Member
Posted: 23 November 2011 01:53 PM   Total Posts: 43

Hi,

I’m loading a 3ds model this way:

Loader3D.enableParser(Max3DSParser);
   
loader3D = new Loader3D();
   
loader3D.addEventListener(LoaderEvent.RESOURCE_COMPLETEonSuccess);
   
loader3D.addEventListener(LoaderEvent.LOAD_ERRORonResourceLoadingError);
   
loader3D.load(new URLRequest(modelUrl)); 

The thing is, material is loaded automatically (I think), and I don’t know how to set alphablending = true.

Without this, the transparent parts of the material (png) are rendered in black.

Is there a way to change this?

thanks:)

   

Avatar
maddog, Sr. Member
Posted: 23 November 2011 05:54 PM   Total Posts: 118   [ # 1 ]

set up a action listener for asset complete

then

loader3D.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);

private function 
onAssetComplete(event:AssetEvent):void
  {
   
   OBJECT3d 
Mesh(AssetLibrary.getAsset('ObjectName'));///Make sure you name you objects in 3d editor you need name here.
   
OBJECT3d.material =  new BitmapMaterial((new modelTexture()).bitmapData);
   var 
mat OBJECT3d.material;
   
mat.alphaBlending true
  

at least I think this would work maybe

   

_kihu, Jr. Member
Posted: 28 November 2011 10:12 AM   Total Posts: 43   [ # 2 ]

So, is this officially the proper way to load models to away3d apps, using AssetLibrary? Is there a way to omit the requirement for the object name, perhaps define the name in code after it’s loaded?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X