OpenGL API Specifications
Documents and Learning ResourcesSupport Libraries and FrameworksFunction Libraries and GeneratorsThis list contains some basic resources for getting started with, and developing for, OpenGL 3.0 and onwards. Contact your forum moderator if you want to contribute to the list or have any comments.Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 29 June 2012 - 12:50 PM
Posted 29 June 2012 - 02:34 PM
Posted 29 June 2012 - 02:58 PM
Edited by PaloDeQueso, 29 June 2012 - 02:59 PM.
Posted 29 June 2012 - 03:03 PM
Posted 29 June 2012 - 03:17 PM
Posted 29 June 2012 - 03:35 PM
Mesh matrices are relative to the Scene, and has to be computed just like the bones. If that isn't done, all meshes will be drawn over each other, at the same position.
Each node inaiNodeAnim has a matrix that transforms from the parent. To get the transformation matrix of Bone2, a matrix multiplication is needed: Scene*Armature*Bone1*Bone2. This is true for the bind pose, as well as for the animations of bones. But when computing animation matrices, data from aiNodeAnim is used and replace the data from aiNode. When testing that animation works, start with defining an animation at the same rotation, location and scaling as the bind pose. That would give bone replacement matrices that are the same as the originally defined in aiNode.
The above matrix multiplication gives the absolute matrices for each bone. But that can't be used to transform the mesh vertices yet, as it will give the animated locations of the bones. The mesh absolute rest position is Scene*Mesh. Instead of using the mesh transformation matrix from the node tree, a new mesh matrix is computed based on the bones and an offset. There is a matrix that is meant for exactly that, and it is the offset matrix inaiBone. The new mesh matrix is Scene*Armature*Bone1*Bone2*Offs. This is the bone matrix that shall be sent to the shader.
Edited by PaloDeQueso, 29 June 2012 - 03:48 PM.
Posted 29 June 2012 - 03:42 PM
No....
Also, is the bind pose in inverse format, and if so do I need to un-invert it?
Matrix multiplication is associative, which means (A*B)*C=A*(B*C), but not commutative (A*B is not equal to B*A). That means you may go top down, or bottom up, as long as you always have the parent matrix on the left side.When you mention cascaded multiplication, do you mean having to multiply up the tree or down it?
Posted 29 June 2012 - 06:51 PM
Posted 29 June 2012 - 09:18 PM
void AnimationState::Update(float frame_time){ EG::Dynamics::Animation *animation = animations->Get(current_animation); float animation_duration = animation->GetDuration(); animation_time += frame_time; if (animation_time > animation_duration) { animation_time = glm::mod(animation_time, animation_duration); } // Traverse Tree and Multiply Aptly, as well as apply Bind Pose Properly std::vector<glm::mat4> unmultiplied_transforms = animation->GetTransforms(animation_time); for (unsigned int i = 0; i < unmultiplied_transforms.size(); i++) { Bone *b = animations->GetBindPose()->GetBone(i); glm::mat4 offset = b->GetOffset(); glm::mat4 result = glm::mat4(1.0f); std::vector<glm::mat4> stack; while (b) { //offset = unmultiplied_transforms[b->GetId()] * offset; result = unmultiplied_transforms[b->GetId()] * result; b = b->GetParent(); } transforms[i] = result * offset; } }
Posted 02 July 2012 - 11:16 AM
Posted 02 July 2012 - 02:37 PM
Side note... the code I currently have does not work with the intel hd 3000, which claims to support opengl 3 but appears to be missing some key features.
Posted 03 July 2012 - 06:41 AM
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.