• 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
jeffkingdev

Skinning + Bone Look At

5 posts in this topic

Hello,

I have a skinned + animated model. It's a character model. I'm trying to get his head to look at an object in world space. This is the problem. If I take his head local matrix and build a matrix that looks at the world space object, that doesn't work. This is because when the matrix gets combined with the parent the matrix isn't looking in the right direction.

My final matrix looks like this..

Final = InvBindPose * LocalBone * CombinedParents;

So, how do I get my localBone matrix to be the correct one to look at an object in world space? Do I need to invert the combinedParents matrix and then re-translate it from the combinedParents matrix? to get it in the right position after the look at is applied?

Any help or ideas would be helpful

Thanks
0

Share this post


Link to post
Share on other sites
From your equation, I assume you are using the v*M notation, and will use the same below.

First, compute a standard LookAt matrix that orients the front vector in the local bone space towards the desired world space direction. For reference, see e.g. MathGeoLib [url="http://clb.demon.fi/MathGeoLib/docs/float3x4_LookAt.php"]float3x4::LookAt[/url], and its [url="http://clb.demon.fi/MathGeoLib/docs/float3x3.cpp_code.html#612"]derivation[/url].

Let's denote the lookat matrix by L. We want this matrix L to be the local->world matrix for the bone, but since the bone has parent nodes, we have a sequence local->parent->world. The problem is to compute such a local->parent matrix M for the bone, so that the local->world matrix for that bone will end up to be L. You say you know the parent->world transform (your CombinedParents matrix), so let's denote that by P. Then, we have the equation

local->world == local->parent * parent->world, or in terms of matrices above
L == M * P, where we solve for the desired M,
M = L * P^(-1).

Therefore, compute the local->world LookAt matrix L, then compute the world transform of the parent, P, inverse it, and compute L * P^(-1), and set that as the local->parent matrix M for the bone.

In your terms, you will then have

Final = InvBindPose * M.
1

Share this post


Link to post
Share on other sites
Clb,

Fantastic response. I am able to build a look at matrix and place it in the right position from the inverse parent transform.

So I do...

newLocalBone = LookAt * InvCombinedParents;

That works perfect. Now, I'm having trouble converting my world space pos into the (at) position in my LookAt matrix.

Do I transform my world space point by what to get a point relative to my Bone matrix? Then I can subtract my localbone pos to get the foward vector ?

Any ideas would be great.

Thanks
0

Share this post


Link to post
Share on other sites
As a test I am setting up my Look at as...

LookAt = Eye(0,0,0) , At(0,0,1) , Up(0,1,0);

The head is correctly facing forward always... however as I rotate the character in the world, his head is always forward facing on the body. I am trying to get him to look down world Z instead of model/mesh space Z. So, I tried multiplying LookAt * InvWorld, but that didn't work. What should I do with my WorldMatrix to multiiply it with my new LookAt to get it in world space always?

Thanks
0

Share this post


Link to post
Share on other sites
Your bone matrix transforms from the bone's local space to its parent space. If you combine the transforms W*B1*B2*B3*...*BN, you will get a matrix which transforms from the local space of bone BN to the world space. W is a matrix that transforms from the local space of the object to the world space. B1 is the root bone's local->parent matrix. (Depending on your setup, you may or may not have a separate matrix W, and might just treat B1 as W).

To transform from world space to the bone's local space, compute the matrix M^-1, where M = W*B1*B2*B3*...*BN. That matrix will take world space points/direction vectors into the local space of bone BN.

If that's still not working, try pasting some code if someone can spot something that's off.
1

Share this post


Link to post
Share on other sites
clb,

That worked perfect. Just knowing what I am doing is correct helped a lot as I could focus on other stuff that may have been wrong. I think the biggest thing is my model is coming from max which has a different coordinate system. So, I'm basically trying to figure out how to change my look at matrix to match it's coordinate system in the bind pose so the face is facing the right direction. I think I can take it from here. I'll PM you if I have any other questions.

You've been a great help!
Thanks!
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