Jump to content
  • Advertisement
Sign in to follow this  
codemastermm

OpenGL OBJ Model Movement

This topic is 4813 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 am curious as to what the best (and proper) way for "movement" with OBJ 3D Model files (my friend creates the models while I program, so I dont have much knowledge with the modeling processes). Anyway, my question is what should I do for the movement of, let's say a character, that is an OBJ Model file? Such as if I currently have a character standing still and I want him or her to switch to a walking model, would I simply load and display the walking model rather than the standing model or is there a way to have all of the different "stances" compacted into one model and I can switch inbetween the various "stances". If it helps at all, I am coding in Visual Studio .NET 2003 with C++ and I am trying to use OpenGL with SDL (for cross-compatibility) Thanks for any great help; your forum has given me alot of great ideas and solved many problems over the years :D

Share this post


Link to post
Share on other sites
Advertisement
The obj model format doesn't store any animation information. It just stores a scene, and it's material information.

[Edited by - Vampyre_Dark on June 16, 2005 4:45:51 PM]

Share this post


Link to post
Share on other sites
alright, thank you much.

I will probably have each "stance" in a separate model, then, and hold the "status" of a character in an enum variable.

Share this post


Link to post
Share on other sites
Quote:
Original post by codemastermm
alright, thank you much.

I will probably have each "stance" in a separate model, then, and hold the "status" of a character in an enum variable.


You mean 1 model per animation frame?

Check out anim8tor (sic).

Import your model, rig it to a skeleton, then make and save your animations.

http://en.wikipedia.org/wiki/Skeletal_animation

Share this post


Link to post
Share on other sites
so if i load that model and just display it in OpenGL just as i would a normal still model, it'll move and the such, even though in OpenGL i never set it to move at all?

Share this post


Link to post
Share on other sites
Quote:
Original post by codemastermm
so if i load that model and just display it in OpenGL just as i would a normal still model, it'll move and the such, even though in OpenGL i never set it to move at all?


No. It's not going to render automatically. You will still have to position it, and then deform it based on the position of the bones in that frame.

Share this post


Link to post
Share on other sites
codemastermm, what you are talking about is referred to as keyframe animation. Each "frame" of animation is stored in a separate file (in most cases). All you have to do is load each model ONCE at the init stage of your program (game). And just switch between the models when rendering. For example: Walking might be files / keyframes 1, 2 and 3. Jumping might be files 7, 8, and 9 - so when the player jumps, you cycle through frames 7, 8 and 9. Easy hey?

Share this post


Link to post
Share on other sites
thank you much; it seems like a bit of a hassale but is logical.
is there an easy way to create all of the frame models? such as perhaps making an animation and then creating models for each frame of it?

Share this post


Link to post
Share on other sites
You don't store every frame in a new file. And you don't create new models for every frame.

Creating new models and storing them for everyframe deafeats the purpose of using a skeleton! You keep 1 model, and you deform it around the current skeleton shape.


*Pseudo Code

Get the skeleton's pose. (a frame generated on the fly between 2 keyframes)
Deform a temp copy of your model around the pose.
Render it.


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!