Normaly it is possible to do by multiplying ModelViewInverse by [0,0,0,1].
But how to obtain object-space location of camera in GLSL shader(i.e. without sending MVI from application code)?
Normaly it is possible to do by multiplying ModelViewInverse by [0,0,0,1].
But how to obtain object-space location of camera in GLSL shader(i.e. without sending MVI from application code)?
Originally posted by ayaromenok:
[b]Normaly it is possible to do by multiplying ModelViewInverse by [0,0,0,1].
But how to obtain object-space location of camera in GLSL shader(i.e. without sending MVI from application code)?[/b]
you can do the multiplication in your c/c++ code, and send the result as a uniform.
Pierre B.
you can do the multiplication in your c/c++ code, and send the result as a uniform.
Thanks, but I was asking about solution without sending MVI from app.
Something like state.matrix.modelview.inverse from ARB_vp.
Join the club
Especially this issue is a main point of critic to me, a clear step backwards from the ARB extensions.
nVidia extended ‘their’ glslang with the inverse matrices, a very good extension in my opinion.
/me hope for a revised spec of glslang, with a lot more, like:
#include -> for some stuff like the following to extract from every shader into another file (point 2)
#ifndef ARB_some_fancy_extension
… do stuff like typedef float half;
#endif
file support
inverse and transpose versions of the matrices (or everything in the state as in the ARB extensions)
p.s. another thing is, that operations like inverse(gl_ModelViewMatrix); should be for free (because gl_ModelViewMatrix is a uniform Variable.
Originally posted by Chris Lux:
[b]Join the club
Especially this issue is a main point of critic to me, a clear step backwards from the ARB extensions.
nVidia extended ‘their’ glslang with the inverse matrices, a very good extension in my opinion.
/me hope for a revised spec of glslang, with a lot more, like:
- #include -> for some stuff like the following to extract from every shader into another file (point 2)
#ifndef ARB_some_fancy_extension
… do stuff like typedef float half;
#endif
- file support
- inverse and transpose versions of the matrices (or everything in the state as in the ARB extensions)
p.s. another thing is, that operations like inverse(gl_ModelViewMatrix); should be for free (because gl_ModelViewMatrix is a uniform Variable.[/b]
In general, yes (so please not another flamewar about good and bad of the glsl-spec), just some notes:
you can already accomplish this by simply passing the glShaderSourceARB several strings
what do you mean with that? the problem is, that the gl might be running on a server, while your client has the files…
there’s noone stopping the compiler-writers to do exactly what you said in your p.s., I don’t know if they already do, though.
Jan
nVidia extended ‘their’ glslang with the inverse matrices, a very good extension in my opinion.
For me is clear how to use Cg data types in nVidia GLSL inmplementation, but how to do this with Matrices?
Ok, I find, how to use Cg state and it is a sutable solution right now(anyway I use NV hardware). Thanks to all.
But in general, it is really not clear situation with inverse/trasform in GLSL.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.