Jump to content
  • Advertisement
Sign in to follow this  
Quat

Dynamic Branching Skinning

This topic is 2336 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 have meshes that support between 1-4 bone influences per vertex. At compile time, I could create 4 different versions of my skinning shader, and then switch shaders. So if the vertices of a given mesh had at most 3 bone influences, it would pick the shader that supports 3 bone influences. However, if some of the vertices only needed 1 or 2 bones, it would waste calculations.

I am wondering if on modern GPU it is better to just use dynamic branching? There will probably be good thread coherence, and it will help minimize shader state changes, and avoid wasted calculations on bones with weights 0.0. Does this sound like a good plan?

Share this post


Link to post
Share on other sites
Advertisement
In my experience, using branching to skip bones with a weight of 0 is definitely a win.

Share this post


Link to post
Share on other sites
Even if you can't use dynamic branching (e.g. you need to run on downlevel hardware) the extra "wasted" calculations (I don't really like use of the word "wasted" here - the calculations are most definitely not being "wasted" - they have a purpose which is to avoid shader changes; it's still a purpose, just not related to the specific end result of the skinning operation) will still perform quite good and possibly much better than a version with lots of shader changes.

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!