Results 1 to 2 of 2

Thread: Duplicate materials - what do I draw?

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    6

    Duplicate materials - what do I draw?

    This maybe a completely stupid question to ask but it is now puzzling me as to how to render or choose the correct material to draw in Collada 1.4.1 if more than one material is listed in the instance geometry.

    A colleague designed a village on Google Sketchup for me and I have been trying to view it in our own bespoke viewer. From the geometry library there appears to be 2 sets of triangles to be be rendered with different materials. On closer inspection it turns out the triangles in each set overlap each other 100%. Tracing back to the instance geomtry we see the two materials 'bound in' to the geometry:-[attachment=2:3p7hgo3o]instancegeometryPNG.PNG[/attachment:3p7hgo3o]

    Using the Collada viewer from the Mac we get this bitmap :-[attachment=1:3p7hgo3o]mac_preview_version.png[/attachment:3p7hgo3o]
    Which is correct.

    Unfortunately by choosing the first material from the list of 2 I get:-[attachment=0:3p7hgo3o]IMG_0038.PNG[/attachment:3p7hgo3o]
    Please note the missing materials. I chose the first one listed in the set as the material to use. If I chose the other material, then the missing roofs would be drawn but the materials on the current ones would not be drawn.

    Best wishes
    Gordon Pagan

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: Duplicate materials - what do I draw?

    In COLLADA, geometry primitives request a material using a symbolic name. In the instance declaration, the actual materials are bound. This is explained on pdf page 320 of the 1.5 spec.

    Your software must match of the material attribute values in the mesh with the instance material symbol attributes, then resolve the associated target attribute to the actual material. In your example there must be some mesh primitives with e.g.

    Code :
    <geometry>
     <mesh>
      <triangles material="Material1">
      <triangles material="Material2">

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •