Is there any way of specifying that a mesh is associated with more than one convex_mesh? Looking through the spec, it doesn’t seem so, but can’t believe it’s that unusual. Basicall,y I’ve got a convex decomposition of a mesh (multiple convex_hulls approximating the mesh geometry), and want to export both the original mesh and it’s decomposition.
The association between <convex_mesh> and <mesh> goes the other way around. The idea is that one can use a <convex_mesh> for collision/physics, that actually does not contain any geometry, but just a link to a <mesh>. This is because most collision/physics engine will take the <mesh> and create the geometry for the convex mesh at load time.
If you want to have several representations, and have the run-time to decide which one you want to be using, or have your conditioning tools to decide what to do with the data, then you want to have enough meta data to know that there is a dependency, and provide the run-time or other intermediate tools the extra information.
Create as many <geometry> as representations and
use the <asset> element on to mark elements to be assets (<asset><source_data> contains the URI of the original dataset)
use the <asset><keywords> to provide your run-time / conditioning application with additional information. Provide additional information with the <extra><profile> mechanism.
Alternatively it is possible to store many <mesh> and <convex_mesh> in a single <geometry>, but it is harder for a tool to separate the assets if you need to. If you want to do that you can use the <extra> element on each <mesh> and <convex_mesh>.
Thanks for that, makes some sense - I can have multiple convex_mesh elements, but the convex_mesh_of attribute of each convex_mesh can all point to the same mesh. Agree some extra metadata would be required for interpretation.
Alternatively it is possible to store many <mesh> and <convex_mesh> in a single <geometry>
Bit confused on this last point, though. In the geometry section of the spec, it says:
Note: Exactly one of the child elements <convex_mesh>, <mesh>, or <spline> must occur. They are mutually exclusive.
Are you saying you can have more than one element in each geometry, so long as they are all the same type?
It is possible to have as many type of mesh (lines, linestrips, polygons, polylists…) in a <mesh>, but you are right that only one <mesh> or <spline> or <convex_mesh> can be in a <geometry>. Somehow I thought we had the same concept on <geometry> that we have on <mesh>…
Then there is no other choice than creating one <geometry> for each representation of the same “object”.
This is something more and more relevant in COLLADA since in the future other forms of geometric description will be added, and thus more and more interest for multi-representation.
For rigidbodies it is possible to add multiple collision shapes into a single rigidbody. So the collision representation of a single rigidbody can contain a shape array containing multiple <box> <sphere> <instance_geometry> etc. Each instance_geometry can point to a <convex_mesh>. The <convex_mesh> might just contain vertices (a point cloud) or triangles (connected vertices).
Typically you perform a convex decomposition and add all parts to one or more rigidbodies.