Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mati

Scene graph traversal w / matrix stack

This topic is 5181 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''m new to D3D but have been using OpenGL for awhile. My question involves understanding how transform hierarchies differ between the two. Take a hypothetical example of transforming a vertex in the arm of a human, in OpenGL I''d think of that as: v(world) = M(body) * M(torso) * M(arm) * v(local) My intuitive understanding is that reading from left to right can be thought of as a step-by-step transformation of the local basis, from the world to the body, torso, then arm, and that reading from right to left is the order in which the transformations are applied to the vertex to get it to the right place in world space. So when doing a depth-first traversal, for example from the body to the torso, I can push the current model matrix onto the stack, postmultiply it with M(torso) (the transformation from body space to torso space), do my stuff then pop it when I move back up. In DirectX everything is transposed and reversed. Using the ID3DXMatrixStack interface, I can use the MultMatrixLocal() function to pre-multiply what''s on the matrix stack and achieve the same effect as OpenGL''s glMultMatrix(). However, in the matrix stack example at MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/advancedtopics/vertexpipe/matrixstack/matrixstack.asp), they use MultMatrix(), which is a postmultiply, when moving down the hierarchy. I don''t understand how one would construct a hierarchical model like this. Is it something I''m missing that''s conceptually different from how I think of things? Thanks, -mati

Share this post


Link to post
Share on other sites
Advertisement
DirectX allready has an inhouse implemented scene graph:
D3DXFRAME structure is a node in the scene graph.

When you do skinned mesh in direct3D you acctualy create a Scene graph with the bip01 as the top of the graph and all other are children or siblings.

Check the Skinned Mesh Demo. In the DXSDK there is the skinned mesh file named "Tiny.X". Open the file with the DXMeshViewer and save is as .X (ASCII TEXT). Now you will se how DX arranges it, altough the file will be huge!

Share this post


Link to post
Share on other sites

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