Jump to content
  • Advertisement
Sign in to follow this  
gotov

Hardware Morphing

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

Hello, I'm trying to animate a face using hardware morphing technique(HLSL),and I'm programming in C++. My problem is that I have a variable numbers of morph targets for the same mesh, and because of that my declarations of positions are variable too. ex. In one pass there are 5 morph targets,second time 2 morph targets and so on... Is there same method which I could use for declarations of positions depending on the number of morph targets using in that pass.

Share this post


Link to post
Share on other sites
Advertisement
Well, assuming DX9, you could have different vertex declarations, one for each count of morph targets that are active. You could specify a base vertex format that lives on stream 0, then your first active morph target position value could be added on stream 1, etc.

That way, when you determine your active morph targets for given render, you select and bind the appropriate vertex declaration, bind the vertex offset streams, and map the morph blend percentages into (presumably) your vertex shader constant.

Or, if you wanted to be lazy, you could have, say, 4 morph targets active all the time, and keep one vertex format bound, but bind buffers with all zeroes into the morph streams for the morph targets that aren't active.

Share this post


Link to post
Share on other sites
Thx,
but that doesn't solve my problem because in one mesh I have 16 morph targets, and the caps.MaxStreams is 16, so my graphics card can't handle the number of input streams.
Is there any other way? Maybe something similar to skinning way?

Share this post


Link to post
Share on other sites
Do you want to be able to enable an arbitrary number of morphs at once, or just a few?

For most applications limiting yourself to 1 or 2 morphs is fine. In such a case, create three techniques for rendering: BaseMesh, OneMorph, and TwoMorphs. Bind morph buffers to Stream1 (and 2) whenever a morph is active. You can have 100 morph targets if you want, just so long as only 0, 1, or 2 are active at once.

Share this post


Link to post
Share on other sites
I want enable an arbitrary number of morphs at once. I know that limiting to one or two morphs is fine, but I'm remodeling one students program for 3D rendering so it will be able to use hardware morphing, and in one case, while speaking Japanese use 16 morphs at once.

Share this post


Link to post
Share on other sites
Theoretically, you could write your morph data into one or several textures and using a texturelookup in the vertexshader, but that requires either R2VB or VS30 capable hardware.

Share this post


Link to post
Share on other sites
Quote:
Original post by gotov
Thx,
but that doesn't solve my problem because in one mesh I have 16 morph targets, and the caps.MaxStreams is 16, so my graphics card can't handle the number of input streams.
Is there any other way? Maybe something similar to skinning way?


I'd say do it on the CPU, then.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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