Loading models that use jpgs as well as pngs with transparency [solved]

Software: Away3D 4.x

IanCheung, Newbie
Posted: 12 January 2012 01:45 PM   Total Posts: 2

Hey all

What is the recommended thing to do if a loaded model uses a combination of jpgs and pngs, where jpgs are used whenever possible and pngs are used only where transparency is needed?

In the event handler for AssetEvent.ASSET_COMPLETE I can find out the file extensions of bitmaps, and I have access to the materials used - but I can’t figure out how to find out which materials use which bitmaps. If I knew that, then I can just set alphaBlending to true for those materials that use png files.

I’d really appreciate any pointers in the right direction

Thanks

   

IanCheung, Newbie
Posted: 12 January 2012 03:37 PM   Total Posts: 2   [ # 1 ]

I’ve found a solution, not sure if there’s a better way but it seems to work.

loader.addEventListener(AssetEvent.MATERIAL_COMPLETEonMaterialComplete);
private function 
onMaterialComplete(ev:AssetEvent):void
{
 
var mat:BitmapMaterial BitmapMaterial(ev.asset);
 if (
mat.diffuseMethod.bitmapData.transparent)
 
{
  mat
.alphaBlending true;
 
}
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X