Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to load (non-interactive) animations (made using Maya) into OpenGL ES on iOS and Android

So far we have been able to successfully load static OBJ files (converted to .h) into our OpenGL application.

We can then apply transforms to these objects in order to animate them.

The next step on our project is to have a professional 3D animator do the animations in Maya, and create a "Loader" to display them in 3D using OpenGL.

We have found lots of examples online that deal with video games and loading static models, but our animations will be absolutely pre-defined by the animator, we just need to load them.

It is important to mention we cannot render it int oa video because we are building this on top of an AR library which will let users literally walk around the animation, that part is solved, we just need to get the animations to render using OpenGL.

I have looked into this question regarding the appropriate format the animator should use to export from Maya.

.dae (COLLADA) file format seems to be a good way to encapsulate model and animation information, and the loading it using Assimp but we have not found this loader compiled for iOS or Android (which are the platforms we are developing for).

Another approach we have seen recommended online is to export a series of OBJ files and load the corresponding OBJ for each frame.

Another approach we see around is to use an "Engine", but there are so many it is hard to know which one we should focus on.

We do not mind paying for an Engine but how do we know which one will work best?

We found these examples, but we do not see a clear "Winner".

Has anyone gotten something like this working on iOS or Android devices?

What would be your recommendations?

like image 683
Zebs Avatar asked Aug 28 '12 07:08

Zebs


2 Answers

Well, OpenGL(-ES) itself is just a drawing API, it doesn't do anything related to animation. Animation playback is managed by a own animation system. The output of such a system are transformation parameters, that you can later use to place and deform geometry when drawing with OpenGL. The usual approach to this these days is a skeletal animation system, i.e. you add some skeleton to the model, where each vertex is bound to a set of bones, with per vertex-per bone weighting. Bones can be represented as a combination of a translation and a quaternion. The translation usually is a constant, so what the usual animation system gives you is the vector of quaternions describing the skeleton pose. This you load into a uniform (a vec4) or a GL_RGBA32F 1D texture with the width being the number of bones, which is used in the vertex shader to apply per-vertex transformation based on the pose. The vertex-bone weights usually are submitted as additional vertex attributes.

like image 53
datenwolf Avatar answered Oct 01 '22 01:10

datenwolf


I've done a 3D framework for Android and this is how I thought animation:

Skeletal animation ca be done simply with you code: load an OBJ for every limb and let the CPU do the skeletal computations, then transform each OBJ to the coordinates and angles given by the CPU.

Keyframe animation can be done by using OBJs that have the same number of vertices. You can then use linear function that takes a variable t(time) and gives you the combined mesh. You can also use Bezier curves for smoother animations.

Another aspect I'd like to point is that you can import MD5 files. MD5 files can contain animation data and they're binary, so loading them is fast and does not require a parser.

More on MD5s here.

P.S. If you want, I can recommend you a great book that covers a lot of 3D issues when developing on mobile; just leave a comment. And.. if you don't mind spending money, just buy Unity. It's very good and it's very versatile.

like image 45
dragostis Avatar answered Oct 01 '22 03:10

dragostis