GL Tools / Texture projection Matrices

franz's picture

Hi, i would like to arbitrarily project a texture on a surface, according to the camera view, so that the texture stays aligned to the camera (or any fixed point). Sounds a bit complicated to explain, so i've included a picture that shows the desired effect. This is based on an interesting link: http://www.opengl.org/resources/code/samples/mjktips/projtex/index.html

however, i'm too lost to produce interesting results.

I guess this should have something to do with the GL Load Matrix patch, but it is really under-documented. I've also tryied, unsuccessfully, to fiddle with a GLSL shader, where you can declare and multiply projection matrices....

Maybe someone here will just see what i mean, and show me the way (or the link ... ?) Thanks in advance for any hint.

PreviewAttachmentSize
projtex2.gif
projtex2.gif19.92 KB

yanomano's picture
Texture projection

Hi franz, it seems you are talking about "camera mapping" or "projection mapping" : This is also called sometimes "stained glass shadows" ex : in After Effects you put a textured layer between a light and the geometry and the layer project his shadow that is colored by the color of each pixel of the texture. (So finally you have a projected image)

This is a french tuto for a GLSL shader not a problem for you i think ;)

Texture mapping Ozone3D

Also very interested to do this but was not able to have this shader work...

dwskau's picture
Re: GL Tools / Texture projection Matrices

It's funny that this is coming up because I was just wishing I could do this earlier this week. I also had no idea where to start... The reason I was trying to do this is to be able to create a "shadow" of an object on a ground plane. I don't care about the object casting shadows on itself, only on a ground plane and this would allow me to do that.

gtoledo3's picture
Re: GL Tools / Texture projection Matrices

Hmm, this is one of those really inspiring chains of thought. This WOULD be quite interesting... it's one of those things that it almost seems like I have been on the tip of before but never thought too much about it to actually purposely implement.... (going to noodle around now...)