Jump to content

Recommended Posts

Well, thats more than most of us have done. All the best with it (y)

Yesterday, I managed to export your lion blend to the game (after a few hours of bug-fixing). I think I have it all figured out (assuming the rig doesn't already exist for an animal, in which case it might be necessary to re-rig it), so I might write a tutorial for exporting (once I've checked that the method works most or all the time...).

~Zaggy1024

Link to post
Share on other sites

Hi Zaggy. Do you have the svn (latest) version of 0AD installed? (If you don't know what that is see here: http://trac.wildfiregames.com/wiki/BuildInstructions)

If you do have the svn version, take a look at the Iberian siege ram - I committed some Blender animations for it yesterday. I also animated some ships yesterday but am unable to make them work without crashing the game first. Oh joy :D

(assuming the rig doesn't already exist for an animal, in which case it might be necessary to re-rig it)

In the 0AD directory take a look at this file: binaries\data\mods\public\art\skeletons\skeletons.xml - it shows the bone names and hierarchy of existing skeletons.

Link to post
Share on other sites
Do you have the svn (latest) version of 0AD installed? (If you don't know what that is see here: http://trac.wildfire...ildInstructions)

I don't have the latest revision, but I do have the latest autobuild (I decided to use the dev build ppa).

If you do have the svn version, take a look at the Iberian siege ram - I committed some Blender animations for it yesterday. I also animated some ships yesterday but am unable to make them work without crashing the game first. Oh joy :D

If you mean that you made Collada files and put them in the game, it might be preferable for me to have the actual blends for the animations, since it takes a lot of tweaking of that and the game files to get it working in the game.

In the 0AD directory take a look at this file: binaries\data\mods\public\art\skeletons\skeletons.xml - it shows the bone names and hierarchy of existing skeletons.

I know about that file, since I had to play around with it a bunch to get the lion in the game.

Edit:

When I exported a third idle animation for the lion, it showed up in the game with the head and body spinning in a circle every few seconds (seemingly when one of the bones crosses the Y axis, negative or positive), so something'll have to be done about that... and since I don't know C++, I'll leave it to someone who does to try and fix it. Here is the set of animations I had done yesterday, which includes at least two broken animations (since then, I've animated two or three more, all of which didn't import into the game correctly...).

~Zaggy1024

Edited by Zaggy1024
Link to post
Share on other sites

Edit:

When I exported a third idle animation for the lion, it showed up in the game with the head and body spinning in a circle every few seconds (seemingly when one of the bones crosses the Y axis, negative or positive), so something'll have to be done about that... and since I don't know C++, I'll leave it to someone who does to try and fix it. Here is the set of animations I had done yesterday, which includes at least two broken animations (since then, I've animated two or three more, all of which didn't import into the game correctly...).

Unfortunately I've experienced similar bugs and difficulties with importing. In the Iberian siege ram's animation the wheels spin backwards after spinning forwards - which is a bug with the way 0AD converts the Collada files. I'd like to know if the same bug also affects 3DS Max Collada animations - in theory it should.

Link to post
Share on other sites

I just read an announcement about the Google Summer of Code. If I understand it correct, one of the projects is to implement or improve the COLLADA-animation-support of Blender. I don't understand it but you can read about it here:

http://code.blender.org/index.php/2011/04/google-summer-of-code-2011-blender-summer-of-polish-2/

and here(if you type "blender" as organization):

http://www.google-melange.com/gsoc/projects/list/google/gsoc2011

I hope it will help anyone.

Link to post
Share on other sites

Unfortunately I've experienced similar bugs and difficulties with importing. In the Iberian siege ram's animation the wheels spin backwards after spinning forwards - which is a bug with the way 0AD converts the Collada files. I'd like to know if the same bug also affects 3DS Max Collada animations - in theory it should.

If you're saying you think some of the 3ds Max animations might be messed up, I haven't seen any that are (though some attack animations look slightly strange)... but d'you actually know of what might be causing it in the game?

~Zaggy1024

Link to post
Share on other sites
  • 3 weeks later...

I happened to notice one TODO comment in the code which might potentially explain some problems with modifying skeletons.xml: when the game first successfully loads a .dae file it converts it to .pmd format and then caches the result (for efficiency); if the .dae file changes then it re-converts to pick up the latest changes, but if skeletons.xml changes then it doesn't notice and doesn't re-convert the models and will still use the old cached .pmd (which was built with the old skeletons.xml). You can delete the cache by deleting ~/.cache/0ad/ (on Linux / OS X) or %appdata%\0ad\cache\ (on Windows) which will force it to re-convert everything, or you can modify the .dae file (e.g. just export it again to update the 'last modified' time) to force it to get reloaded. (It would certainly be better if the code handled this properly instead of requiring manual deletion, so that ought to get fixed some time.)

In the Iberian siege ram's animation the wheels spin backwards after spinning forwards - which is a bug with the way 0AD converts the Collada files.

Technically it's not the Collada conversion that's the problem (I think), it's the way the engine handles looped animations. If the animation has keyframes A,B,C then the engine interpolates between A and B, then between B and C, then between C and A, then starts from the beginning again, in order to loop smoothly. There's no way it can handle a continuously-spinning wheel since that requires a sudden jump from one keyframe (360 degree rotation) to another (0 degree) when looping.

The Collada converter assumes the input animation has keyframes A,B,C,A (which seemed to be how at least 3ds Max tended to handle looping, I think), so it always drops the last keyframe to get it in the format the engine expects. Maybe it'd be possible to change it to stop dropping the last keyframe, and stop the engine interpolating from the last keyframe back to the first (for models exported in the new mode), to let it handle this better.

(Just to be clear, by "keyframes" I don't mean the keyframes used explicitly in the animation program - the importer flattens everything into 30 frames per second, which the engine then treats as the keyframes it interpolates between (to ensure smooth animation at >30fps).)

Link to post
Share on other sites
Maybe it'd be possible to change it to stop dropping the last keyframe, and stop the engine interpolating from the last keyframe back to the first (for models exported in the new mode), to let it handle this better.

Hmm, I'm not thinking that would be a good idea. Wouldn't it effect all existing animations and require a tweak?

I'm not familiar with how blender animation (key frames and interpolation) works, but in theory I would think it would the same as Max.

What I always tried to do to get a perfect transition was clone my animation both before and after the frames I wanted to export. To use Philip's analogy, you want frames:

ABC

So, copy those frames both before and after, to be:

ABCABCABC

Then, export the middle bolded frames. This ensures that position/rotation/translation between frames A & C are consistent both at the start and the end of the animation.

You want the bezier interpelation to be calculated the same for both the entrance and exit.

Like this:

curv00iq5.jpg

Not like this:

curv01oi8.jpg

If you take the steps above, I think it helps with that.

No guarantees it will fix your wheel problem though :P Though, I think that is what I did for the chariot. You would have to look at the file in the art svn to be sure though.

Hope that helps.

Link to post
Share on other sites

Thanks for the tips guys. For the animation to look correct within Blender, the IPO for the 4 wheeled ram looks something like this:

post-9743-0-84449600-1305671443_thumb.jp

Which doesn't make any sense to me.

I've tried it with linear, curve, and a mixture of both interpolation methods, including a similar shape to the one posted above. I need to get a bit more familiar with Blender 2.5, I haven't used it much and the animation functions have changed.

Link to post
Share on other sites

Sorry I'm at work now and won't be able to show you the ram's legend until I get home tonight (have been working really long hours for the past few weeks).

Best online example I could find is this:

731f41018d.jpg

Notice the W, X, Y and Z quaternion rotations in the middle left window - these are the ones that appear in my Ram's curve above. Hope that's helpful for now.

Link to post
Share on other sites

Ah, if it's quaternions then I think that diagram makes sense - if you convert from Euler angles with a constantly-increasing angle then the W component is a cosine curve, and the other components are sine curves scaled by some axis-dependent value. (Adding more keyframes would let it be a better approximation of sin/cos). (Quaternions are weird and make no logical sense, but they're nice mathematically). I have no idea if Blender gives the option of switching to Euler rotation, which would work with straight-line parameters instead.

Link to post
Share on other sites

Apparently new to Blender 2.5 is the option to use Euler bone rotation. Until I get home tonight I won't be able to confirm that, and there's surprisingly not very much info available online, but maybe changing it will solve all our Blender animation bugs? :D

Edit: I created a new Euler bone rotation, but the wheels still turn backwards after turning forwards.

Link to post
Share on other sites
  • 2 months later...

There was a discussion in IRC about importing the game's models into Blender (.dae COLLADA files), some people are having problems with this. I installed Blender 2.58.1 to see what the process looks like. The built-in importer gave a message "cannot create image" but silently failed otherwise.

I'm not sure if it's a known problem, but apparently the importer doesn't like the absolute path(s) in <library_images>, so I removed that element from the test file and also the reference to it in <library_effects>. Then the file was able to import. Looks like a bug in the importer maybe, does anyone else have this problem?

Link to post
Share on other sites
  • 3 months later...

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.

×
×
  • Create New...