Game Development Community

Inverse View matrix in shaders

by Ilusis · in Torque Game Engine Advanced · 09/25/2009 (6:47 pm) · 2 replies

I'm having some troubles using shaders in torque, I need to use the Inverse View and Inverse World matrices, but I can't find anywhere how to do it. It would be great if someone could help me! (sorry for my english, not my first language)

#1
10/03/2009 (2:34 pm)
I think you might have to do quite a bit of hacking to do this because TGEA passes in a single model-view-projection matrix. If you look at method

ProcessedShaderMaterial::setTransforms()

it should give you some idea of where start. I think you'd have to do something like add some new handles to class ShaderConstHandles and then populate them in the above function, something like

MatrixF viewInverse(view);
viewInverse.affineInverse();
shaderConsts->set(handles->mMyInverseViewHandle, viewInverse);

and edit shaders\shdrConsts.h to match.
#2
10/06/2009 (6:53 pm)
Thanks!