View Full Version : New shader functions
02-28-2006, 08: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.
If i am not mistaken those matrices were added in GLSL 1.1.
Yep, here it is:
03-01-2006, 05:47 AM
no, these are states. I am talking about functions that can perform on given uniforms.
03-01-2006, 08: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.
03-01-2006, 10: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.
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...
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.