Jump to content

Blender Support


Recommended Posts

(There's been some relevant discussion elsewhere but it probably makes sense to move it here to avoid clutter.)

I tried exporting a simple skeletal animation from Blender 2.56a Beta, and it seems to work. There's an armature named "Armature", with bones named "Bone" (the root), "Bone.000", "Bone.001", "Bone.002", "Bone.003", and a mesh with an Armature modifier and some weights painted on. The mesh is just a subdivided cube with UV unwrapped. The bones have some Rotation keyframes so they animate over 30 frames.

The exported .dae file says things like

    <visual_scene id="Scene" name="Scene">
<node id="Armature" type="NODE">
<node id="Armature_Bone" name="Bone" sid="Armature_Bone" type="JOINT">
<node id="Armature_Bone_000" name="Bone.000" sid="Armature_Bone_000" type="JOINT">
...

Then I added a bit to art/skeletons/skeletons.xml:

    <standard_skeleton title="Blob test" id="blob">
<bone name="root">
<bone name="r1">
<bone name="r2"/>
</bone>
<bone name="l1">
<bone name="l2"/>
</bone>
</bone>
</standard_skeleton>

<skeleton title="Blender blob test" target="blob">
<identifier>
<root>Armature</root>
</identifier>
<bone name="Bone">
<target>root</target>
<bone name="Bone_000">
<target>r1</target>
<bone name="Bone_001">
<target>r2</target>
</bone>
</bone>
<bone name="Bone_002">
<target>l1</target>
<bone name="Bone_003">
<target>l2</target>
</bone>
</bone>
</bone>
</skeleton>

The <standard_skeleton> is just needed because this doesn't map onto pre-defined ones like "Standard biped". (Any new bipedal skeletons ought to use "Standard biped" so they can share animations/meshes from 3ds Max and XSI, and change the <target> names in the <skeleton> so they map the Blender bone names onto the Standard Biped bone names.)

The <skeleton> uses <identifier><root>Armature... to match <node id="Armature" .../> (from the name of the armature in the Blender scene). (Ought to rename it in Blender to "ArmatureBlob" or "ArmatureBiped" or whatever so the different shapes are distinguishable). Then it uses <bone name="Bone"> and <bone name="Bone_000">, because that matches the Collada file's <node ... name="Bone"> and <node ... name="Bone.000"> with the "."s replaced with "_". (To be precise, all characters in the name except for a-z, A-Z, 0-9, "_", "-" will be replaced with "_". I think the Collada importer library the game uses is unnecessarily strict, but that's what it does, so it's probably easiest to put up with it and remember to do the character replacements when writing skeletons.xml, or perhaps avoid using names containing "." inside Blender.)

Then I copied the .dae file into animations/ and meshes/ (because in this case it contains both parts), and set up an actor with it, and looked in the actor viewer and clicked "play" and it ran the animation properly.

So I think there's nothing fundamentally broken here in Blender or the game (except for our general lack of documentation of this process). Has anyone else managed to get this much to work and then failed with more complex things, or not even got this far?

Link to comment
Share on other sites

Thanks for explaining the skeletons.xml stuff and the bone naming rules.

Has anyone else managed to get this much to work and then failed with more complex things, or not even got this far?

I don't think any of us got that far. Using Blender 2.56a beta for static models quite often produces Collada errors within 0AD, so I've tried to stick to the tried and tested 2.49b when experimenting with animations.

Link to comment
Share on other sites

Do you have an example of a file that causes errors?

It sounds there's going to be a non-beta release of Blender 2.5 pretty soon, so I'd imagine it makes more sense to focus on supporting that (and doing any necessary bug-fixes) so we can stick with it for the next couple of years and not worry about changing again or getting too outdated. Hopefully its current problems aren't fatal and impossible to fix :)

Link to comment
Share on other sites

Do you have an example of a file that causes errors?

I'll have a look, although I've probably deleted them all by now (plus those may have been from 2.55 beta not 2.56a)

Thanks for taking a look for me, hope my step-by-step tutorial was a little helpful, despite being aimed at 2.49b. I wonder how compatible Blender 2.5 animations will be with the 3DS Max Collada importer.

Link to comment
Share on other sites

I tried this:

* Opened that .blend file in 2.56a.

* Renamed "Armature" to "ArmatureLion".

* Exported to a .dae file in meshes/ and again in animation/

* Added the attached bits of XML into skeletons/skeleton.xml.

* Created an actor with the mesh and animation.

* Viewed it in the actor viewer.

* Clicked "play" to animate it.

* Saw it animate like it should :)

lionskeleton.xml

Link to comment
Share on other sites

Join all your objects into 1 mesh. Manually convert all your quad faces to tris, and make sure all the UV information is within the UV artboard. Also delete any camaras or lights. The 2.56a exporter doesn't have any settings, so you have to do all the clearing before exporting.

I started testing it last night, but I got home from work too late to get very far. On friday evening I'll have time though.

Link to comment
Share on other sites

I'm doing something wrong. 0AD's not recognising the skeleton structure of this animated ram model:

[REMOVED]

I added this to skeletons.xml -

	<standard_skeleton title="Four Wheel Ram" id="Ram">
<bone name="RamBone">
<bone name="WheelLeftBack"></bone>
<bone name="WheelLeftFront"></bone>
<bone name="WheelRightBack"></bone>
<bone name="WheelRightFront"></bone>
<bone name="Weapon"></bone>
</bone>
</standard_skeleton>

<skeleton title="Four Wheel Ram" target="Ram">
<identifier>
<root>FourWheelRam</root>
</identifier>
<bone name="RamBone"><target>RamBone</target>
<bone name="WheelLeftBack"><target>WheelLeftBack</target></bone>
<bone name="WheelLeftFront"><target>WheelLeftFront</target></bone>
<bone name="WheelRightBack"><target>WheelRightBack</target></bone>
<bone name="WheelRightFront"><target>WheelRightFront</target></bone>
<bone name="Weapon"><target>Weapon</target></bone>
</bone>
</skeleton>

Link to comment
Share on other sites

I added that XML into skeletons.xml (at the end, just before the </skeletons>), made an actor like

<?xml version="1.0" encoding="utf-8"?>
<actor version="1">
<castshadow/>
<group>
<variant>
<mesh>temp/0ADIberianRammove.dae</mesh>
<texture>null_white.dds</texture>
<animations>
<animation file="test/0ADIberianRammove.dae" name="Idle" speed="100"/>
</animations>
</variant>
</group>
</actor>

and selected the actor in Atlas and it worked okay for me. (The only problem is it expects animations to be smoothly looping, with the first frame identical to the last frame (if I remember correctly), so the wheels turn forwards and then quickly spin backwards before starting again.)

Link to comment
Share on other sites

Hmm... I think there's actually two problems here.

The Blender file has 3 keyframes, each rotating by 120 degrees (I assume) in the same direction, but when we import the Collada file it acts like the third keyframe has rotation 0 instead of 360, so between the 2nd and 3rd keyframes it rotates backwards. That might be a problem in Blender's Collada exporter or our Collada importer or our code that uses the importer, so I guess I ought to investigate that.

The other problem is that our graphics system stores the animations with (I think) 30 keyframes per second (regardless of the input animation) and then interpolates smoothly between each keyframe, and when it reaches the end of a looping animation it interpolates between the last keyframe and the first, to avoid any sudden jumps. So even if the animation was imported correctly, it'd interpolate from 360 degree rotation to 0 degree in 1/30th of a second. In this case we really want a sudden jump, so I'm not currently sure how to distinguish the cases and handle them correctly.

Link to comment
Share on other sites

ERROR: Collada error: Assertion not satisfied (line 389): failed requirement "recognised skeleton structure"
ERROR: CSkeletonAnimManager::GetAnimation(art/animation/test/0ADIberianRammove.dae): Failed loading, marked file as bad

I still receive the above error in Atlas, even when I use the actor code you posted. Perhaps it could be because I test in Alpha3, and you're probably testing in an up-to-date version. I'll work it out.

I confirm that in Blender the ram wheels turn 120 degrees in the correct direction in each of the 3 keyframes.

Link to comment
Share on other sites

I managed to import an idle animation for the deer into Blender and then export a modified version into the game, although it was messed up extremely because Blender imported the armature at least 10 times the size.

28vxeeo.png

It may not look too great, but at least it got into Atlas. =P

~Zaggy1024

Edited by Zaggy1024
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...