• 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

Skinning Matrices [Solved]

2 posts in this topic

I'm attempting to animate a skinned mesh with joints. I have looked at many different materials, and something isn't right with my understanding. All of my nodes hold a local and global matrix. When I load in the joints, I calculate the inverse pose matrix like so:

[b]Pose Matrix[/b] = Mesh's Inverse Global * Joint Global
[b]Inverse Pose Matrix[/b] = Inverse of Pose Matrix

Then when my joints are updated, I calculate the joint in mesh space and multiply it with the inverse pose matrix.

[b]Joint wrt Mesh[/b] = Mesh's Inverse Global * Joint Global
[b]Deform Matrix[/b] = Joint wrt Mesh * Inverse Pose Matrix

I uploaded the following video files to demonstrate what is happening to my mesh. Is my algorithm correct in handling the matrices in mesh space and calculating the inverse pose matrix? If I knew that, it would be easier to further study the problem.

[url="http://tinypic.com/r/ncmnpj/5"]Source animation..[/url]

[url="http://tinypic.com/r/egviqf/5"]My Results..[/url]

These are my references -
[url="http://books.google.com/books?id=79ud9_8mbgYC&pg=PA507&lpg=PA507&dq=inverse+world+space+transform&source=bl&ots=HppyGTOg-X&sig=Ml4rrZSWndjs9h6AA9ITAp6Nksw&hl=en&sa=X&ei=3-uRT4unHpDZiAKywZ3UDQ&ved=0CDQQ6AEwAw#v=onepage&q=inverse%20world%20space%20transform&f=false"]Introduction to Game Development[/url]
[url="http://www.google.com/url?sa=t&rct=j&q=cse169_05&source=web&cd=1&ved=0CCQQFjAA&url=http%3A%2F%2Fgraphics.ucsd.edu%2Fcourses%2Fcse169_w05%2FCSE169_05.ppt&ei=9keST46TPImMiAKc1egK&usg=AFQjCNFDvvY9-EYOrd_sG0tt8pk4GfLhYQ"]UCSD - Skinning powerpoint[/url]
[url="http://www.google.com/url?sa=t&rct=j&q=jason%20gregory%20animation&source=web&cd=1&ved=0CCgQFjAA&url=http%3A%2F%2Fwww-scf.usc.edu%2F~gamedev%2Fanimation.ppt&ei=V0iST9zTGIqZiQKEuIQi&usg=AFQjCNHeOuIxEasJgntrrrGEBb97jApV9w"]Animation in Video Games[/url]

Share this post

Link to post
Share on other sites
Hi, the solution in my game engine is the following:
struct Bone {
Matrix4 staticMat;
unsigned int jointIndex;
std::string name;
std::vector<Bone*> children;

struct Skeleton {
Bone* rootBone;
std::map<std::string, Bone*> bones;

struct BonePose {
Matrix4 poseMat, dynamicMat;

class SkeletonPose {
std::map<std::string, BonePose*> bonePoses;
SkeletonPose(Skeleton* skeleton);
void calculateBonePose(Bone* bone, Bone* parentBone);
void calculateDisplayMatrix(Bone* bone, Bone* parentBone, Matrix4* mats);

void SkeletonPose::calculateBonePose(Bone* bone, Bone* parentBone) {
BonePose* bonePose = bonePoses[bone->name];
if(parentBone) {
bonePose->dynamicMat = bonePose->poseMat;
bonePose->dynamicMat *= bonePoses[parentBone->name]->dynamicMat;
}else{ //Is root bone
bonePose->dynamicMat = bonePose->poseMat;
for(unsigned int i = 0; i < bone->children.size(); i ++)
calculateBonePose(bone->children[i], bone);

void SkeletonPose::calculateDisplayMatrix(Bone* bone, Bone* parentBone, Matrix4* mats) {
Matrix4 mat;
mats[bone->jointIndex] = mat * bonePoses[bone->name]->dynamicMat;
for(unsigned int i = 0; i < bone->children.size(); i ++)
calculateDisplayMatrix(bone->children[i], bone, mats);

//Draw Frame

//Calculate the hierarchical transformations of the skeleton
skeletonPose->calculateBonePose(humanModel->skeleton->rootBone, NULL);

//Calculate the matrices used in the shader
Matrix4* mats = new Matrix4[skeleton->bones.size()];
skeletonPose->calculateDisplayMatrix(skeleton->rootBone, NULL, mats);
currentShaderProgram->setUniformMatrix4("jointMats", mats, skeleton->bones.size());
delete [] mats;
for(unsigned int i = 0; i < meshes.size(); i ++)

I hope you can understand my code [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img].

Share this post

Link to post
Share on other sites
Thank you - I'll look over this and see where my code differs. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

EDIT: I found that my code is correct, but I didn't notice that all of the joints were using global positions, which is why the rotations appear to be offset. In Modo 401 'weightmap deformers' were used to rig geometry, and I didn't realize that the center of all the deformers was zero while the pivot position was always relative to the model center.

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