New shader functions

Can we have more shader functions to complement the set that we already have. for example, a Matrix Inverse and a Matrix transpose would be very helpful especially in skinning.

Thanks. :slight_smile:

If i am not mistaken those matrices were added in GLSL 1.1.

Yep, here it is:

no, these are states. I am talking about functions that can perform on given uniforms.

matrix inverse is very complex operation - it’s very inefficient to perform it on every vertex/fragment. you’d better invert it in your code and send as uniform.

There simply aren’t enough uniforms to hold both bones and their inverse transforms.
if you have a skeleton made up of 36 bones, then you need 36 * 8 uniforms = 288 uniforms.
current HW only supports 256 native uniforms.
the only other way is to brake up the model in parts and render each part separately, which in my opiion is inefficient and convoluted.


However, i assume you know how to invert a matrix (with all the Determinants and stuff…). Then you know, that performing this in a vertex-shader needs more processing power and hardware resources than (current high end) hardware can give you.

At the moment you are pretty much stuck. I had the same problem. The only thing you can try, is to use quaternions to rotate your skeleton, instead of matrices, that can cut down memory consumption by half. But still you won’t be able to use many bones.

It WILL get better, with future hardware, which supports more uniforms. But right now, it’s really difficult. Either perform it on the CPU or wait for better hardware, if that is an option.

There are many reasons, why ie. the Doom Engine does all the skinning on the CPU. It’s not only the stencil-shadows…


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.