PDA

View Full Version : New shader functions



selwakad
02-28-2006, 09:39 AM
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. :)

Jan
02-28-2006, 12:17 PM
If i am not mistaken those matrices were added in GLSL 1.1.

Jan
02-28-2006, 12:20 PM
Yep, here it is:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/GLSLangSpec.Full.1.10.59.pdf

selwakad
03-01-2006, 06:47 AM
no, these are states. I am talking about functions that can perform on given uniforms.

grisha
03-01-2006, 09:21 AM
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.

selwakad
03-01-2006, 11:38 AM
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.

Jan
03-01-2006, 02:43 PM
True.

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

Jan.