Sign in to follow this  
Quat

Dynamic Branching Skinning

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this