Ykkrosh Posted April 6, 2011 Report Share Posted April 6, 2011 (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? Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 6, 2011 Report Share Posted April 6, 2011 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. Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted April 6, 2011 Author Report Share Posted April 6, 2011 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 Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 6, 2011 Report Share Posted April 6, 2011 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. Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 6, 2011 Report Share Posted April 6, 2011 I've got an animated lion .blend file. Lion Rigged. I tried exporting it once, but it didn't work... I did some crap with the bones and all, but it was crap Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted April 6, 2011 Author Report Share Posted April 6, 2011 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 Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 6, 2011 Report Share Posted April 6, 2011 Brilliant! Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 7, 2011 Report Share Posted April 7, 2011 Strange...when i try exporting from 2.56a i get this. Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 7, 2011 Report Share Posted April 7, 2011 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. Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 7, 2011 Report Share Posted April 7, 2011 okay, i see. I'll delete the camera and lights...but i need separate objects so i'll delete the ones i don't want.[EDIT] OH WOW!!! IT WORKED!!! AWESOME!!! THANKS!!! (forgive the capitals, i'm very excited ) Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 7, 2011 Report Share Posted April 7, 2011 Did you animate something?? Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 7, 2011 Report Share Posted April 7, 2011 Can you commit the lion anim for us(meaning me) to see how its done? Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 7, 2011 Report Share Posted April 7, 2011 lol, no. I just exported a mesh with 2.56a I'll get down to animating something soon(though i'm not very good at it) Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 7, 2011 Report Share Posted April 7, 2011 Oh ok BTW does the lion have a walk animation? Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 7, 2011 Report Share Posted April 7, 2011 No...i tried to make one... it sucked his paws need some extra bones i think :/ I'm outta touch with animation, haven't done anything since i was 14 Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 7, 2011 Report Share Posted April 7, 2011 I've only ever animated mechanical objects (spaceships, tanks, and boats) so the lion will be a challenge for me too Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 7, 2011 Report Share Posted April 7, 2011 Cool, i'm checking out some videos and i've brushed up on my knowledge. Gonna give it a try (BTW, can you use a movie clip as a background in blender?) Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 8, 2011 Report Share Posted April 8, 2011 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> Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted April 9, 2011 Author Report Share Posted April 9, 2011 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.) Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 9, 2011 Report Share Posted April 9, 2011 Weird. The wheels turn 360 in Blender in a 30 frame animation, so they should loop in 0AD too. I can't look at it now, but maybe very late tonight when I get home.Not sure why it played for you but not for me. Thanks for testing Ykkrosh! Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 9, 2011 Report Share Posted April 9, 2011 I think it turns back -360 degrees...I remember coming across this problem once :/ A solution would be to add an extra frame where you rotate it -360 degrees just one frame before the last(i don't know if it will work though). Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted April 9, 2011 Author Report Share Posted April 9, 2011 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. Quote Link to comment Share on other sites More sharing options...
Pureon Posted April 9, 2011 Report Share Posted April 9, 2011 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 badI 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. Quote Link to comment Share on other sites More sharing options...
Zaggy1024 Posted April 15, 2011 Report Share Posted April 15, 2011 (edited) 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.It may not look too great, but at least it got into Atlas. =P~Zaggy1024 Edited April 15, 2011 by Zaggy1024 Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted April 16, 2011 Report Share Posted April 16, 2011 Well, thats more than most of us have done. All the best with it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.