PDA

View Full Version : Animating OBJ objects



SOLNEGRO
02-03-2010, 11:40 AM
hi, I don't know if there is other entry with the same question, sorry if this entry already exist. Anyway, I am trying to load an OBj object with Opengl, and my question is, Is it possible to animate a OBJ model? or I have to use another format such as MD2.

For example: Can I load a Human OBJ format model, and make it walk trough the Scene by using arrow keys, or I have to use and already animated format?

I am really confused with that, if any of you can explain me how it works I will appreciate it

cheers

Jan
02-03-2010, 11:57 AM
OBJ-files don't contain information how to animate a mesh. You can't store a skeleton or an animation in it. The only thing you can do is to export several versions of a mesh in different states (one OBJ-file for each state). But real animations can't be exported via OBJ.

Personally i use .x-files to load animated meshes, but i am only a beginner in this area myself. The MD2 and MD5 format is an option, though i never liked, that it is not a real industry-standard but really only id-softwares stuff. There's also Collada and maybe FBX that you could take a look at. Collada should be future-proof, though in my experience the support from modeling tools ranges from very good to extremely poor, so you might need to first check how well your favorite software copes with it.

Jan.

SOLNEGRO
02-03-2010, 12:16 PM
Thank you for the fast answer! :D

Now i have it a bit more clear.

So, you need a format that has the info on how to animate a mesh in orther to animate it via OPENGL. So OBJ is only a static format, isn't it?

And... I've read that load animated .x files with OPENGL is not that good as .x is a D3D format. How true is this?
Thanks

Jan
02-03-2010, 03:57 PM
You have to get one thing straight: OpenGL (or D3D) won't animated ANYTHING for you. It is YOUR job to tell your favorite 3D API HOW to animated a mesh.

OpenGL (and D3D) cannot load OBJ files, YOU have to load them. The same is true for any other format. YOU need to extract the animation information and YOU need to write drawing routines that create an animated result.

The only difference about the file-formats is that some can hold the information, that you need and some can't. x-files can be loaded from any application, no matter whether it uses D3D or OpenGL (though D3D brings helper-functions that make it much easier).

OBJ files are usually used for static meshes, because you can't store animation data in them. x-files can store animation information and are thus suitable for doing animations. But no matter which format you use, you will need to extract the data and implement all the animation routines yourself. And let me tell you, that can be quite the butt-pain.

Jan.

SOLNEGRO
02-04-2010, 08:27 AM
Thank you so much Jan, that is the explanation I was looking for... I been searching in the internet and together with your explanation all is soooo much clear.

cheer for that :D

SirDeathKnight
05-18-2012, 07:04 AM
Sorry this reply is so late after the initial questions but there is a solution to this, although the .obj specification doesnt support animations natively, by simply augmenting it with a seperate .anm file you can get brilliant albeit boneless animations.

Have a look at:- http://www.sanguinelabs.co.uk/expose/product.php?id=wastudio

This provides a very easy to use "animation maker" as well as the open-source model library (for OpenGL).

Note: It was developed as the obj file format is widely used yet difficult to animate... just as you stated.