Jump to content
  • Advertisement
Sign in to follow this  
tatet

Why is it so hard to do animations?

This topic is 759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've tried with OpenGL, ThreeJS, BabylonJS, but everytime it's really hard to find good tutorials to animate .obj files.

Is there anything good out there? Why is it that hard?

My aim is just to take a Blender object and show animations, in any language or with any API.

Every tutorial works with .md2, but I don't want to use it!

Edited by tatet

Share this post


Link to post
Share on other sites
Advertisement
Maybe it's hard because .obj files don't support animation. Or am I missing something?

Share this post


Link to post
Share on other sites

The basic concepts behind animations are fairly easy to grasp. Most difficulties are hidden in the implementation details however. There is a short tutorial on animations with DirectX here on GameDev: Animating Characters with DirectX. It uses X files which are a relatively simple model format supporting animations.

 

Please, keep in mind that most games / game engines do not use any of the popular 3D file formats, but their own custom formats to suit their specific needs best. Typically, 3D models and animations are created in a 3D program and then exported / converted to the specific format of the game / game engine. Actually, there is a very popular library - AssImp, which is strictly intended for such purposes.

 

Hope this helps.

Share this post


Link to post
Share on other sites

The Wavefront .obj format does not support animations but it does support "parts". You could write your own animation system to perform keyframe based animation (probably with interpolation). However you would also have to develop your own tool to create the animations. Personally this work is worth it since keyframe animation is really simple and fast and for small models (especially on mobile it looks quite good).

 

I wrote a tool that does this a while back that I can dig out for you if you would be interested in it (might take a couple of days to find it ;)). Here is a video of it:

 

 

I also provide an API for OpenGL that reads in the data and displays it you can use as a reference for the engine you are using.

 

You might also want to look at other file formats such as fbx or COLLADA which do embed animation data into them. It also means that you can do animation using Blender, Maya etc...

 

Some links to stuff:

http://www.autodesk.com/products/fbx/overview (FBX SDK to help load the FBX animation data).

http://threejs.org/docs/#Reference/Loaders/ColladaLoader (Example COLLADA loader for Three.js).

Edited by Karsten_

Share this post


Link to post
Share on other sites

Maybe it's hard because .obj files don't support animation. Or am I missing something?

Alright, read my first post with "any format that supports animation of any kind (moving bones manually, keyframes, ..)" instead of "obj"

 

The basic concepts behind animations are fairly easy to grasp. Most difficulties are hidden in the implementation details however. There is a short tutorial on animations with DirectX here on GameDev: Animating Characters with DirectX. It uses X files which are a relatively simple model format supporting animations.

 

Please, keep in mind that most games / game engines do not use any of the popular 3D file formats, but their own custom formats to suit their specific needs best. Typically, 3D models and animations are created in a 3D program and then exported / converted to the specific format of the game / game engine. Actually, there is a very popular library - AssImp, which is strictly intended for such purposes.

 

Hope this helps.

I didn't know it; anyway, I downloaded some free 3D models, as I want to do some codes now. I'll try with Assimp !

 

The Wavefront .obj format does not support animations but it does support "parts". You could write your own animation system to perform keyframe based animation (probably with interpolation). However you would also have to develop your own tool to create the animations. Personally this work is worth it since keyframe animation is really simple and fast and for small models (especially on mobile it looks quite good).

 

I wrote a tool that does this a while back that I can dig out for you if you would be interested in it (might take a couple of days to find it ;)). Here is a video of it:

 

 

I also provide an API for OpenGL that reads in the data and displays it you can use as a reference for the engine you are using.

 

You might also want to look at other file formats such as fbx or COLLADA which do embed animation data into them. It also means that you can do animation using Blender, Maya etc...

 

Some links to stuff:

http://www.autodesk.com/products/fbx/overview (FBX SDK to help load the FBX animation data).

http://threejs.org/docs/#Reference/Loaders/ColladaLoader (Example COLLADA loader for Three.js).

Any format is fine for me, as I'm not currently interested in making one. And ok! I'll wait for your tool ^^

Share this post


Link to post
Share on other sites

I've tried with OpenGL, ThreeJS, BabylonJS, but everytime it's really hard to find good tutorials to animate .obj files.

Is there anything good out there? Why is it that hard?

My aim is just to take a Blender object and show animations, in any language or with any API.

Every tutorial works with .md2, but I don't want to use it!

 

I haven't worked with OBJ, but I think they might be right that it does not support skinned animation. It may not even support rigid animation.

 

Skinned animation is a pretty difficult subject, and implementing it involves a small mountain of data that can get kind of confusing. That's probably why you don't see many tutorials on it, especially good ones: few people doing tutorials probably actually understand it. It's one thing to use a library (maybe ASSIMP) to load a model and have the library animate it. It's something entirely different to actually understand how and why skinned animation works.

 

The first step is to get a deep understanding of rigid animation. Skinned animation is basically the same thing, just far more complicated. So, rigid animation gets you about a quarter of the way there once you understand that, not to mention you will then understand rigid animation, which you will need to know anyway. Rigid animation is nothing but matrix algebra. So, understanding vectors and especially matrices and how to use them is really the key to that whole thing.

 

I've posted my project file on my website for everyone to learn from and/or make use of. It doesn't do skinned animation. I wrote a custom exporter in Python to export the model data from Blender to my own custom file format that is easy to understand. (That's included in the files of the project. When you write your own exporter you can tell it to include whatever you like and so it will support anything you tell it to support.) Then I wrote a loader class and a model class in C++ for DX11. It reads the custom model file and supports textures and rigid animation. It does not however support skinned animation. But you might find it useful to get that far anyway.

 

It also doesn't actually do any rigid animation, but it's setup to support it to the point of you just need 2 or 3 lines of code to implement some rigid animation.

 

Rigid animation is just every sub-mesh parented to the main mesh has it's own world/object matrix and you manipulate them individually. If you multiply the parent times the child to get the child's matrix (rather than hard coding the child's matrix) you can move the child independent of the parent and the child will always be relative to the child.

 

The armatures in skinned animation work on the same principle. So, getting a solid understanding of that is the first step.

 

Anyway, the project files can be found on my website. That code was written to run on Windows 7 and you'll likely have problems and need to rewrite a few things if you try to run it on a higher version of Windows although the code changes are probably fairly minor.

 

Oh. I might also mention that my current project is to rewrite all that in OGL 4.5 which I hope to complete in the next month or two. I'm moving from DX11 to OGL.

 

Also, to really understand skinned animation, I think you need to understand it from the artist's side. You need to skin and rig some models and animate them. Then you'll get some idea of how the other side sees it. I mean, until you skin a model, how are you going to understand blend weights?

Edited by BBeck

Share this post


Link to post
Share on other sites

As Karsten eluded to. Vertex tweening is an option when the format you are utilizing for your meshes does not natively support animations. Though to my knowledge it's a bit more memory intensive depending on the complexity of the mesh, however, it is quite simple to implement.

 

Blender does support the rigging of a model, and the exportation of an obj model as "parts" which is essentially just an output of the obj files for the individual key-frames. You then utilize delta time to interpolate the current mesh vertices which lay somewhere between the two key-frames (depending on the delta) creating an animation. Though simple in it's premise several games have, and still do use this method. 

 

From what I understand (could be mistaken) morph targets are still used in several AAA titles for the animation of character faces. The biggest caveat to this animation method though is to be entirely sure that your vertice topology for each keyframe of the mesh is consistent after, and during the exportation of the mesh. Failure to do so will likely cause tearing in the mesh during animation, and other oddities.

 

When exporting a obj model blender provides two check boxes in it's more recent iterations. One is for "animation", and the other is "keep vertex order". The latter being very important as the obj exporter will likely optimize the underlying vertice layout per animation export, creating at a low level what are dissimilar meshes. When performing tweening not keeping this in mind is not conducive for a good time.

 

In conclusion I wouldn't say it's hard to do animations. It can just become very involved depending how complex you wanna make your animation subsystem, much like everything else in software development. It requires knowing the basics of the format you are using, and to avoid the common pitfalls that each format has to offer, and of course the normal software development aspects of it as well.

 

I'll include the pictures for the blender export options:

 

http://i912.photobucket.com/albums/ac327/markypooch/VertexOrderBlend_zpspkdlzl2h.png

 

http://i912.photobucket.com/albums/ac327/markypooch/animBlend_zpsnnrw9k0y.png

 

Marcus

Edited by markypooch

Share this post


Link to post
Share on other sites
Ok tatet, sorry for the delay.

I am still having trouble finding my original tool so I have just fixed up the one provided with my game engine project.
 
bucaneer_editor.png

Unfortunately it is quite a bit more primitive but should do the job for now. We actually used this tool for a small game we made for ExxonMobil so lets just call it "fit for purpose" haha. You will have to build it from source too. If you are still interested you can follow these instructions to build on Windows:
 
<grab a copy of the mutiny source code (from my signature)>
cd bootstrap
bootstrap.bat
cd src\tools\bucaneer
..\..\..\bin\mutt
build\windows\bin\bucaneer.exe
bootstrap.bat will look for a compiler (i.e Visual Studio if installed, clang, or use the internal gcc compiler) and build all dependencies including the mutt build tool.

Any problems, send me an email kpedersen@live.co.uk.

Sorry for the faff ;)

Edit: Ooh, I have now fixed the undo functionality in the tool ;) Edited by Karsten_

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!