Hi,
As the subject says, I experience problem with texture projection in GLSL.
My eventual goal is to write spotlight and directional light shadows in GLSL (I already have those in Cg), but I wanted to start by projecting a simple texture over an even simpler scene. And I got stuck.
Below is a sample showing the problem. The shader kind of works, but there’s one major problem with it. When you move the camera, the nicely projected texture (apparently randomly) turns into static noise…
I would think it’s a matrix issue if it wasn’t that the entire thing seems rather random.
If I deliberately screw up the matrices I get coherently bad results – the texture is projected from the camera, instead of the intended projector, or the texture looks like a set of parallel lines, or it’s just projected top down on the floor, disregarding the lens completely.
But with the issue at hand, this is not the case. The texture looks good at one camera position, while moving the camera a millimeter in any direction brings in the static.
I’m a bit lost and out of ideas, basically…
Sample:
dl.dropbox.com/u/196274/glsl/glslProjected.zip
My spec:
Ubuntu 12.04, 64 bit, fully updated
GF GTX 460
NVidia drivers version 310 (from ubuntu repos, marked as experimental yet battle tested with a significant portion of what is available on Steam for Linux).
Thanks in advance for any input on this.