Several material references for one geometry

Hi all,

Just a question,

I importe the geometry in a DirectX Application, and I’m working on the meterial import.
In the XSD schéma, there is a “bind_material” node in the “instance_geometry” node. And in the definition of mesh triangles, the is also a reference to a material in a attribute of the “triangles” node…

I have exported an object from 3DS Max, and I have a reference to the material in the triangles node, so when the “bind_material” node in the “instance_geometry” node is used?



The <bind_material> is always used to bind the materials specified in the geometry element (via the “material” attribute of a geometric primitive like <triangles>) to actual <material> elements.

When I export a box from max I get a material=“1-_Default” specified on the <triangles> element. That name gets looked up in the <bind_material> to find the actual material element that maps to. Inside the <bind_material> I have <instance_material symbol=“1-_Default” target="#1-_Default">. You find the symbol attribute that matches the name you’re looking for (“1-_Default”) and then the target attribute gives you the ID of the actual <material> element to bind the geometry to. Now in this case (and probably in your case too) the name attached to the <triangles> element (aka the material “symbol”) matches exactly the actual material element’s ID. This is just a coincidence… Max does it this way in this particular case but another tool can have different names for the symbol and the target, e.g.
<triangles material=“myMaterial”>

<instance_material symbol=“myMaterial” target=“1-_Default”>

It’s done this way in order to allow instancing of the geometry where each instance has a different material.

Thank you very much, I understood :slight_smile: