Include a animated model in an OpenGL scene

Started by
5 comments, last by juli1 11 years, 8 months ago
Hi all,

I am currently starting to use OpenGL to write a game of Android. At this time, my scene contained just cube and basic figures so I never try to look at how to render complex things in my world. But now, I have to animate a full person in my world and make it running ! So, for that purpose, I would need to know how to render a model. Because the game is targetted for a mobile platform and I think this might consume a lot of resources, I am looking for efficient solution that might not consume too much resources.

So, I would like to know how to load and animate such a model, do we need to load something from an external program or is it better to do everything programmaticaly ? If we need to build and load a model, is there some tutorial and/or libraries to see how to do/proceed and what are the most efficient way to proceed ? And if I need to build my own animated model, do you have a suggestion about the tool to use ? (possibly for Linux since I am using this platform as my development platform).

Thanks for any help about this,

Best,
Advertisement
I am currently starting to use OpenGL to write a game of Android. At this time, my scene contained just cube and basic figures[/quote]
That is a gigantic step to understanding and using animation. I don't know of any 3rd party tools that will take care of this. I guess it would be best to just use unity or some other big name engine for phones because if all you know is how to move a cube around, then doing an animation system on your own is going to be hard and take a lot of hours.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Ok, thanks for your reply ! Also, as I would like to really understand the internals of OpenGL and how it works, I am ready to spend some time on that topic. So, this is not really a big issue, as long as I have enough book materials that could help me. So, if anybody has some inputs that would help me, I would really appreciate :-)

Greetings,
Like dpadam450 said, going from basic meshes to fully animated models is a big step! But it's not impossible of course. There are several options out there that can help you achieve what you want:

1. Write your own model loader. There are quite a few examples out there for various formats that support. Just dig in what kind of model formats suit your needs best and loop up on how you can load an animate it, you're probably not the only one that asked this question :)

2. Do you really need animation? Well you probably do, but in some cases you can get away with just simple translation/rotation. This all depends on what you want to achieve probably.

3. Use an external library! There are plenty of frameworks/engine out there that have done all the hard work for you, so you can focus on things that are really important, like making the actual game! :P I see Libgdx popping up on a regular basis and there will most likely be plenty of others.

I would say to not try and re-invent the wheel, but it might be a good practice if you want to learn to load the model in yourself. Should you really want to load an animated model yourself, I found that the MD5 model format is the easiest to get in to.

Good luck! :D
I agree defiantly use MD5, it was used in popular games such as Doom 3, Quake, Prey, etc and I was able to find good examples online how to load them and skin them using Blender to rig, animate, etc for my old game engine. Though they are in C++, doesn't mean you can't convert it to Java for Android. Both have very close syntax anyways, and of course to be a good programmer, you kinda have to maybe spend more time on things you really don't want to. lol I don't have any links... But a Google search wouldn't hurt.

Good luck!
Check out my open source code projects/libraries! My Homepage You may learn something.
Considering your response to dpadam, i'm going to simply dive straight into what you need, and what your options are.

Their are several ways to animate an model, but in general, you will first need to write a timer, and frame controller class, so this way you can animate at a specific time step, and determine what frame your animations are on, all animations are going to require being played at some speed, and need to be updated, so a good animation controller class is much needed for w/e way you decide to do animation.

In general, their are two solid approaches to animation that are most usable in games:

A. save the model in a series of frames, and load them. this can be very memory intensive, but gives perfectly free rain to your artists. it's not a method i like due to the high memory requirement's, but it's one of the easiest methods(just check what frame you are on, and draw the appropriate model.)

B. skinning and skeletons, this is the method i personally use to do animations, while it doesn't fit all situations, i've found it to be the least memory intensive, while providing the best results. however, it can be very cpu intensive, directly related to the number of vertice's a model has. This can be offloaded to the gpu later on, when you understand skeletal animation further.

In effect, rotating one bone, will rotate all the vertice's attached to that bone by an influenced weight.

you have alot to learn mate, but at the end of the journey, you'll probably be much better off in what you know.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Hi guys,

Thanks for your contributions and instructing me the different solutions. I will look a little bit the different possibilities and will see. Also, the goal is to learn the roots of OpenGL before using a framework/engine : as for C and assembly language, this is always a good thing to first learn the lower-level aspects before using high-level APIs. And from what I have read and seen, it seems that libgdx would be a good thing for later projects ...

Thanks again,

This topic is closed to new replies.

Advertisement