Accessing Material - Collada

Software: Away3D 3.x

dmen, Newbie
Posted: 10 August 2011 09:31 PM   Total Posts: 11

Loading a collada model and I can get the individual objects from the loaded mesh - as Object3D’s. From there though, I’m so far not able to get the material applied. The same texture/material is applied to all 5 objects contained in the mesh. I need to modify the BitmapData of the material and reapply as necessary.

So - I get the mesh and car body ike:

mesh = e.loader.handle as ObjectContainer3D;
carBody = mesh.getChildByName(“ID9”);

From there though I’m stuck at getting the applied materials.

   

dmen, Newbie
Posted: 11 August 2011 02:05 PM   Total Posts: 11   [ # 1 ]

OK, still struggling with this and really could use a hand.

I load a collada file into ObjectContainer3D - in the model loaded method I do:

meshContainer = ObjectContainer3D(e.loader.handle);

and then I can get the car body and wheels like so:

carBody = meshContainer.getChildByName(“ID9”);
flWheel = meshContainer.getChildByName(“ID45”);

Which makes sense - if you look at this node in the collada file it matches the id of the wheel:

<node id=“ID45” name=“tire_LF”>
          <translate sid=“translate”>-25.6337 10.1852 -40.6953</translate>
          <rotate sid=“rotateY”>0 1 0 -0</rotate>
          <rotate sid=“rotateX”>1 0 0 0</rotate>
          <rotate sid=“rotateZ”>0 0 1 -0</rotate>
          <scale sid=“scale”>1 1 1</scale>
          <instance_geometry url=”#ID46”>
              <bind_material>
                <technique_common>
                  <instance_material symbol=“Material1” target=”#ID3”>
                      <bind_vertex_input semantic=“UVSET0” input_semantic=“TEXCOORD” input_set=“0”>
                  </instance_material>
                </technique_common>
              </bind_material>
          </instance_geometry>
        </node>


And I also see all nodes use the same target on the material #id3. 

How can I get the texture map associated with this?

   

ssanter, Newbie
Posted: 22 August 2011 07:16 AM   Total Posts: 1   [ # 2 ]

I was just trying to do this myself. You’ve probably sorted it by now, but for others trying to solve this…

The solution is to change in the dae file, the symbol material name. See in your dae xml code ’ <instance_material symbol=“Material1” target=”#ID3”>’ everything seems to reference that same Material1 (in my collada file anyway). I just changed that to Material2, Material3, etc and also changed it in the object data further up ‘<triangles count=“28” material=“Material3”>’. This worked for me.

Cheers,

ssanter

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X