Is there a way to successfully use the standard CG inverse(float4x4) / GLSL inverse(mat4) function in a Unity shader? When used in my surface shader, compilation chokes saying GLSL can’t find a valid overload:
GLSL vertex shader: ERROR: 0:356: 'inverse' : no matching overloaded function
#pragma exclude_renderers gles
it compiles, but as soon as I actually patch the code into anything that gets executed (in this case by putting the ‘#pragma vertex:vert’ into the surface shader to run my custom vertex pre-shader), it breaks again and reports inverse is an undefined variable
Program 'vert_surf', undefined variable "inverse"
And before you ask, yes, I really do need to take an inverse here, and no, I can’t guarantee offhand that the matrix will be simple enough to use any of the short-of-really-doing-the-proper-inverse hacks. The only alternative might be if I could couple my own complete vertex shader with a standard surface-shader rather than performing creative pre-vertex-shader-proper math, but I have seen no examples of that being viable.
Cg inverse() def: http://http.developer.nvidia.com/Cg/inverse.html
GLSL inverse() def: http://www.opengl.org/sdk/docs/manglsl/