• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
rubenhak

Need a tip to load biped animation

7 posts in this topic

Hi,

I want to load a character animation from a 3ds max. I'm capable to export transformation based animations (when objects are translated/rotated) into my engine. However in this case there is a mesh of the character which is put on top of the animated skeleton.

With my current techniques of exporting/importing I get the skeleton animated in my engine, but the actual character is not.

What is the technique to make my character to animate instead? Do I need to do some calculations in my engine, or there is more information to grab from 3ds max to make that happen?

Thank you,
Ruben
0

Share this post


Link to post
Share on other sites
Google or search GD for skinning, hardware skinning or GPU skinning - there are hundreds of great sites to help with this
0

Share this post


Link to post
Share on other sites
[quote name='RobMaddison' timestamp='1337629755' post='4941994']
Google or search GD for skinning, hardware skinning or GPU skinning - there are hundreds of great sites to help with this
[/quote]

At this point I'd like to do that on a CPU. Later on might consider doing that on a GPU. Came across this article: [url="http://software.intel.com/file/25267"]http://software.intel.com/file/25267[/url] .
Is it good enough? The basic idea is to multiply the vertex by transformation matrix of the bone and the weight coefficient. Am I going in the correct direction?

Also, how can I pull the information about vertex coefficients from 3ds max? I'm currently using a special 3ds max script that exports the model and transformation animations from the model into my internal format.

Thank you!
0

Share this post


Link to post
Share on other sites
[quote name='rubenhak' timestamp='1337635377' post='4942011']
The basic idea is to multiply the vertex by transformation matrix of the bone and the weight coefficient. Am I going in the correct direction?
[/quote]
Yes, this is the right direction. In general the movment of a vertex depends upon a number of bones (max 4 bones in games is quite common) . How much it depends on the bone is described by the weight, whereas the weights of each vertex sums up to 1. A simple example:
[CODE]
A vertex near the neck depends on the neck, left_shoulder,right_shoulder and spine bone. The weights could look like this:
weight_neck = 0.3
weight_spine = 0.2
weight_left_shoulder = 0.25
weight_right_shoulder = 0.25
Each bone is associated with a transformation matrix, the final vertex position is calculated this way:
final_vertex =
(neck_bone_transformation * vertex) * 0.3 +
(spine_bone_transformation * vertex) * 0.2 +
(left_shoulder_bone_transformation * vertex) * 0.25 +
(right_shoulder_bone_transformation * vertex) * 0.25;
The X_bone_transformation matricies are actually animated (interpolation between two key frames).
[/CODE]

To get this information from max, you should export to a format which supports this, i.e. collada or FBX.

But be aware, getting animation running is not trivial, the basic idea is simple, but there're many pitfalls and debugging hours ahead of you [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
2

Share this post


Link to post
Share on other sites
Ashaman73, for optimization purposes could I do the vertex multiplication only once like this:?
[CODE]
final_vertex =
( neck_bone_transformation * 0.3 +
spine_bone_transformation * 0.2 +
left_shoulder_bone_transformation * 0.25 +
right_shoulder_bone_transformation * 0.25 ) * vertex;
[/CODE]

I'm thinking about writing a max script to export that information into a proprietary format and my engine would load that. That way I would not need to deal with other formats.

At this point I've got the animation of the skeleton loaded into my engine. I just need to animate my object based on that. With this approach I would not be able to benefit from VBO if I decide to perform caculations on the CPU, right?
0

Share this post


Link to post
Share on other sites
[quote name='rubenhak' timestamp='1337714273' post='4942301']
Ashaman73, for optimization purposes could I do the vertex multiplication only once like this:?
[/quote]
You need to consider, that the transformations are matricies (4 vectors) , but matrix-scalar multiplication is commutative and matrix multiplication distributive, therefore you can rewrite the code for better performance.

[quote name='rubenhak' timestamp='1337714273' post='4942301']
I'm thinking about writing a max script to export that information into a proprietary format and my engine would load that. That way I would not need to deal with other formats.
[/quote]
Better to take a known export format like FBX/collada and write a converter between export file and your binary file. This way you can easily support other modelling tools like blender or maya.

[quote name='rubenhak' timestamp='1337714273' post='4942301']
At this point I've got the animation of the skeleton loaded into my engine. I just need to animate my object based on that. With this approach I would not be able to benefit from VBO if I decide to perform caculations on the CPU, right?
[/quote]
The bone interpolation should be done on the CPU, the vertex transformation on the GPU. Edited by Ashaman73
1

Share this post


Link to post
Share on other sites
[quote name='Ashaman73' timestamp='1337751251' post='4942441']
Better to take a known export format like FBX/collada and write a converter between export file and your binary file. This way you can easily support other modelling tools like blender or maya.
[/quote]
I've already got a MAXScript that exports from 3ds max to an intermediate format which my engine consumed. It already exports transformation based animations. I've enhanced it to export vertex weights for skinned meshes and everything worked like a charm. Follow this article if somebody would need a similar thing: [url="http://www.gamedev.net/topic/567949-maxscript-getting-vertex-weights/"]http://www.gamedev.net/topic/567949-maxscript-getting-vertex-weights/[/url]. I had some troubles with "Physique" modifier and could not manage to extract weights from it, but found a utility that converts "Physique" to "Skin" modifier which is a lot simpler to export.

[quote name='Ashaman73' timestamp='1337751251' post='4942441']
The bone interpolation should be done on the CPU, the vertex transformation on the GPU.
[/quote]
Currently do everything with CPU. How would I calculate vertex transformations on GPU?
I can have about 30-40 bones, should I need to have those bone information loaded into the shader?
Isn't there a limitation on the amount of input data the at the shader can accept?
0

Share this post


Link to post
Share on other sites
[quote name='rubenhak' timestamp='1339121564' post='4947245']
[quote name='Ashaman73' timestamp='1337751251' post='4942441']
The bone interpolation should be done on the CPU, the vertex transformation on the GPU.
[/quote]
Currently do everything with CPU. How would I calculate vertex transformations on GPU?
[/quote]
You load the bone transformation matrices as uniforms into the vertex shader, and perform the per-vertex skinning computation there.
[quote name='rubenhak' timestamp='1339121564' post='4947245']
I can have about 30-40 bones, should I need to have those bone information loaded into the shader?[/quote]
load as an array of uniform matrices.
[quote name='rubenhak' timestamp='1339121564' post='4947245']
Isn't there a limitation on the amount of input data the at the shader can accept?
[/quote]
Yes, but that will depend on the make/model of the GPU used.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0