Several material references for one geometry
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.
<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