Adding materials to collada after collada is loaded

Software: Away3D 3.x

Avatar
Bas, Newbie
Posted: 08 September 2011 08:40 AM   Total Posts: 23

Hey all,


I have a collada model loaded but the loader assigns default materials to the model. In Papervision3D i could add all materials to a MaterialsList and add the list to the model on load.
What is the best approach to do this in Away3D??
Can the same be done with Away3D as with Papervision3D or do i have to go through the collada model on load and assign the correct materials then??


I appreciate any help from anyone raspberry
thanks in advance.
Bas

   

SuperPerfundo, Newbie
Posted: 08 September 2011 03:32 PM   Total Posts: 2   [ # 1 ]

I have a similar problem, but think I can help you Bas-

first check out this link: http://www.flashmagazine.com/Tutorials/detail/away3d_basics_6_-_bitmap_materials/

Another option is to use Prefab3d to create a compatible AS3 class. Prefab3d will let you assign your texture pretty easily. I believe it uses your UV mapping set in your collada file.

My problem is that I want to create an interactive (with mouse events) material in Flash CS5 and apply this to my custom 3d object (I made a mobius strip in Blender). I tried using Prefab 3d but it seems to only allow adding an image file as a texture. Will Away3d allow me to map the material correctly? Is there anyway to adjust UV mapping?

I haven’t been able to embed textures and add them to my Prefab3d created object after importing into Flash builder. I get an unusual pop-up error 1037. This leads me to believe I would have to assign custom textures within the AS3 class generated by Prefab.

FYI- I am a total newb using Away3d v3.6, Flash (aka Flex) Builder 4.5 and Flash 5.0

   

bakajin, Newbie
Posted: 09 September 2011 02:22 PM   Total Posts: 24   [ # 2 ]

After much hairpulling this worked for me just fine;

var daeContainer = new Collada();
  daeContainer.scaling = 10;
  daeModel = daeContainer.parseGeometry(<someDAEXMLdata>) as ObjectContainer3D;
       
  daeModel.materialLibrary.getMaterial(”<theMaterialNameFromYour3DScene>”).material = new WhiteShadingBitmapMaterial(Cast.bitmap(<yourBitmapData>));

Where you can load any material type you choose.
Furthermore i found your model needs UV data (or an edit to the AbstractParser).

   

Avatar
Bas, Newbie
Posted: 12 September 2011 06:44 AM   Total Posts: 23   [ # 3 ]

Hey all,

Well finally i got my collada file up and running. Adding uv information to the collada just can’t be done at this moment because the file is generated on a server. So i modified “abstractparser” to get it to work.

The materials also work ok now, i loop through the model and apply the appropriate materials to the faces of all the different meshes.

Thanks all for the useful tips.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X