Materials, templates and instances

Hello,

I’m writing a plug-in to read geometrical templates from COLLADA files. I’m not interested in any instancing information but only the geometry. The problem is that materials are per instances. Geometries have a material entry (example: <triangles count=“2” material=“RedSG”>) but this refers to the instance material symbol and not the material ID (which is “Red” in the example above).

What can I do in this case? Read the geometries, the material symbol and then look for instances to find out the material ID? Is there the possibility to have no instances in the COLLADA scene? How about the case when we have multiple instances of the same template, can we have different materials for the same template?

Any help is appreciated.

Regards,
Adrian Licuriceanu
Quad Software

Geometries only have geometric data. It is purposely decoupled from the materials.

It is not till you instance a geometry you can assign materials. You are right about that.

Your approach would work but, Yes you can have geometries that aren’t instanced in a scene, and Yes you can instance the same geometry multiple times with different materials.

The later of the two is the main reason why geometries and materials are bound upon instantiation.

-Andy