Jump to content

Collada 3D model attach points


Recommended Posts

I've been trying to manually add bones, or attach points, to my Blender 2.5 beta Collada models that are then understood by Pyrogenesis. The bones created from within Blender weren't working, which is why I'm now trying it manually. When Pyrogenesis converts my DAE to PMD format the only attach point that survives is currently the model's root, at 0 0 0.

With the DAE files in the Alpha release, they all use this root as the attach point:


<group>
<variant name="Celtic Great Hall">
<mesh>structural/celt_civic3.dae</mesh>
<props>
<prop actor="props/structures/celts/civic3_props_arch.xml" attachpoint="root"/>
<prop actor="props/structures/celts/civic3_props_1.xml" attachpoint="root"/>
<prop actor="props/structures/celts/civic3_props_new.xml" attachpoint="root"/>
<prop actor="props/structures/decals/gravel_5x5.xml" attachpoint="root"/>
</props>
<texture>structural/celt_struct_1.dds</texture>
</variant>
</group>

With the older PMD model files, some contain many bones/attach points:


<group>
<variant frequency="1" name="base">
<animations>
<animation file="mechanical/ship_idle.psa" name="idle" speed="100"/>
<animation file="mechanical/ship_move.psa" name="walk" speed="100"/>
</animations>
<mesh>structural/hele_bir.pmd</mesh>
<props>
<prop actor="props/structures/hellenes/hele_bir1.xml" attachpoint="props_main"/>
<prop actor="props/structures/hellenes/hele_bir2.xml" attachpoint="mast"/>
<prop actor="props/structures/hellenes/hele_bir3.xml" attachpoint="oars"/>
<prop actor="units/hellenes/themistocles.xml" attachpoint="01"/>
<prop actor="units/hellenes/super_unit_2.xml" attachpoint="03"/>
<prop actor="units/hellenes/infantry_archer_e.xml" attachpoint="04"/>
<prop actor="units/hellenes/infantry_archer_e.xml" attachpoint="06"/>
<prop actor="units/hellenes/super_unit_1.xml" attachpoint="10"/>
<prop actor="units/hellenes/super_unit_2.xml" attachpoint="08"/>
</props>
<texture>structural/hele_bireme.dds</texture>
</variant>
</group>

The Design Document says this about Collada prop points:


Prop points should be defined by creating an object (e.g. a Dummy helper in 3ds Max) named prop-whatever, where the whatever is the name of the prop point. The file data/tools/atlas/lists.xml lists the standard prop attachment points. That object should then be attached to a bone.

As I'm unable to manually view the PMD file's structure, I've been looking closer at the Collada xml, trying to follow the Design document's instructions. Below is one of my many attempts at manually adding a Collada bone called 'props_main':


<visual_scene id="Scene" name="Scene">
<node id="props_main" type="NODE">
<translate sid="location">0.002287626 4.07519e-4 4.418324</translate>
<rotate sid="rotationZ">0 0 1 0</rotate>
<rotate sid="rotationY">0 1 0 0</rotate>
<rotate sid="rotationX">1 0 0 0</rotate>
<scale sid="scale">1 1 1</scale>
<node id="props_main" name="props_main" sid="props_main" type="JOINT">
<translate sid="location">0.002287388 4.07996e-4 4.418324</translate>
<rotate sid="rotationZ">0 0 1 0</rotate>
<rotate sid="rotationY">0 1 0 0</rotate>
<rotate sid="rotationX">1 0 0 89.99999</rotate>
<scale sid="scale">1 1 1</scale>
</node>
</node>
<node id="Cube" type="NODE">
<translate sid="location">0 0 0</translate>
<rotate sid="rotationZ">0 0 1 0</rotate>
<rotate sid="rotationY">0 1 0 0</rotate>
<rotate sid="rotationX">1 0 0 0</rotate>
<scale sid="scale">1 1 1</scale>
<instance_geometry url="#Cube-mesh">
<bind_material>
<technique_common>
<instance_material symbol="Material" target="#Material">
<bind_vertex_input semantic="UVTex" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
</instance_geometry>
</node>
</visual_scene>

In the above code there are 2 nodes (objects), the 'prop_main' object that only contains a bone, and the 'Cube' node that holds the mesh. The sub-node of type JOINT should be the bone, but despite hours of testing, Pyrogenesis still hasn't recognized any of the bones in my DAE file. I've tried many variations of this setup, including having the bone contain the object.

Cutting the long story short, does Pyrogenesis transfer Collada bones when it converts the DAE files to PMD? Sorry if this has been answered previously - I wasn't able to find any more info.

Link to comment
Share on other sites

File formats may be slightly relevant (but not very).

With the DAE files in the Alpha release, they all use this root as the attach point:
Non-skeletal meshes typically just have the automatic "root" prop point and nothing else, which is what you see in those files. Skeletal meshes have arbitrary user-defined prop points, and we support (and use) that in DAE files (as well as in the old PMD files). Non-skeletal meshes also support arbitrary prop points - I think that's not used by current files, and it's barely been tested (I only used it for importing meshes from Spring as a joke), but it should work.

For non-skeletal meshes, I think the structure you need is

	<visual_scene id="Scene" name="Scene">
<node id="Cube" type="NODE">
<translate sid="location">0 0 0</translate>
<rotate sid="rotationZ">0 0 1 0</rotate>
<rotate sid="rotationY">0 1 0 0</rotate>
<rotate sid="rotationX">1 0 0 0</rotate>
<scale sid="scale">1 1 1</scale>
<instance_geometry url="#Cube-mesh">
<bind_material>
<technique_common>
<instance_material symbol="Material" target="#Material">
<bind_vertex_input semantic="UVTex" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
</instance_geometry>
<node id="prop-main" name="prop-main" sid="prop-main" type="JOINT">
<translate sid="location">0.002287388 4.07996e-4 4.418324</translate>
<rotate sid="rotationZ">0 0 1 0</rotate>
<rotate sid="rotationY">0 1 0 0</rotate>
<rotate sid="rotationX">1 0 0 89.99999</rotate>
<scale sid="scale">1 1 1</scale>
</node>
</node>
</visual_scene>

(untested). In particular, you need a <node> called "prop-something", and it needs to be nested inside the main mesh node (the one that contains <instance_geometry>). Then you should be able to use attachpoint="something" in actor XML files.

I think it doesn't require type="JOINT" on the prop node - it can be a type="NODE" if you want. If I remember correctly, Blender has some not-entirely-obvious 'link' command which can be used to set up hierarchies that will be exported to Collada like this.

Skeletal models are very different - they need a skeleton (lots of type="JOINT" nodes) plus a skin (which is some complex controller thing in Collada). Then you add prop points by having prop-* nodes as children of the skeleton's joints. But the game won't let you have a skeleton without a skinned mesh, so you have to do the non-skeletal approach instead.

Link to comment
Share on other sites

Ah ok, so from within Blender the bone needs to be parented to the main mesh. I'll test it out when I get home from work tonight.

Edit: Still haven't managed to get it to work, think I'll give up on trying until the weekend.

Edit2: Had a look at this Maya exported DAE XML below with the line'<skeleton>#neck</skeleton' which my Blender Beta doesn't appear to export. Using this skeleton structure also didn't produce any noteworthy results, just a few different errors i hadn't seen before.

Edit. This was another option, with a different skeleton structure:

http://blog.burlock.org/gaming/193-exporti...via-collada-dae

Creating an armature at (0,0,0), add another bone, parent the bone to the root bone, create a mesh at (0,0,0), parent mesh to the armature. - Didn't work

This guide provides some useful info about the node element...

Will keep trying. I've never had this many problems getting a bone into an engine :ok:

Edited by Pureon
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...