Jump to content
  • Advertisement

Archived

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

DmGoober

Skinned meshes and DX

This topic is 6388 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

Ok i can load and render milkshape files with no problem. I''m using standard Halflife biped2 creatures. Here''s the problem: Both standard vertex blending in direct3d and indexed vertex blending support a minimum of 4 matrices that can be sent to the graphics card with a series of setworldmatrixn calls. Unfortunately, a standard biped2 creature has over 8 bones in the main body (the main body is one solid mesh.) Thus, the main body can be affected by more than eight different matrices. However, as i said, D3D at minimum only supports 4 matrices at a time! Switching matrices in and out as needed will involve breaking the drawindexed primitive call into separate calls for each different set of matrices. This is both inefficient and difficult (i would have to find an algortihm that can group triangles based on their matrix indices.) Anyone have any hints? Thanks. DmGoober

Share this post


Link to post
Share on other sites
Advertisement
as always i find answers to my own problems faster than anyone else.

In both ogl and in d3d if the number of transformations per mesh is larger than the number of transforms allowed in hardware, the transforms are just done manually on the software side. For ogl, that means each vertex is multiplied by its transformation bone, then glVertex3fv is called. This is done for every vertex and its respective bone. In D3d this means taking the vertex buffer, creating a secondary vert buffer, then tranforming each of hte vertices in the vert buffer by its respective bone, then placing the new vert in the new vertex buffer, then rendering off that vertex.

What amazes me is that Halflife does all of this extremely quickly -- i''m not even getting 30 frames a second with my implementation! Yet hl does it along with netcode, game logic, etc.!

DmGoober

Share this post


Link to post
Share on other sites
Hmm - I''ve gotten skin meshes to work perfectly so far. Still working on animations to get a real FPS. With blended index meshes, it has a palette of 256 matrices per bone combination, so you actually set the matrix for each bone at once, then let DX handle it for you. There''s not much to it.

Read through the SkinMesh example and isolate the indexed calls to see what I mean. Also, at minimum a regular blended mesh uses 2 matrices, that''s the reason for the mesh split on cards that use less then 4.



Jim Adams
Author "Programming Role-Playing Games with DirectX"
jimadams@att.net

Share this post


Link to post
Share on other sites
Thanks for the encouragement! After reading your email i realized i was doing something else wrong. . . the 4 limit pertains to number of matrices that can affect EACH vertex. =) Duh!

Software processing guarantees that a matrix palette of 256 is availible. Those of us who can use hardware processing are lucky =)

DmGoober

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!