View Full Version : solve reverse projective texure (q coordinate method)

11-24-2004, 12:09 AM

could someone tell me where I cna find any sample code or any deep explanation about resolving "reverse preojective texturing".

I've read about the "q coordinate" 1D texture map, and I would be very interested by any information or sample code for this method.

thanks for your help

11-24-2004, 01:04 AM
If you are using fragment shaders, just do:

if (texCoordProj.z<=0.0)

11-24-2004, 03:19 AM
thanks, but I cannot use any fragment or pixel shader. I must use the regular pipeline.
So, what about the 1D texture map method when q coordinate is negative ?

I really need to fix this

Jeff Russell
11-30-2004, 04:32 PM
I find a better way to do this is just to use clip planes. Check the manual on glClipPlane; it takes 4 floats (first 3 are the plane normal, 4th is the distance from the origin), and when that clip plane is enabled only goemetry on the 'top' side of the plane is drawn. So for example code to clip everything below y = 2 would look like:

GLDouble plane[] = {0,1,0,2};
glClipPlane( GL_CLIP_PLANE0, plane );
glEnable( GL_CLIP_PLANE0 );
//draw projected texture geometry
glDisable( GL_CLIP_PLANE0 );

Hope that helps.

11-30-2004, 04:42 PM
The danger with user clip planes is that they're not always multi-pass invariant. On NVIDIA hardware they are, but probably not on other hw.

11-30-2004, 08:47 PM
using an ATI Radeon 9700 I have serious problem when i use clip planes to fix this on texture projetion. I have also hear about this 1D Texture Method but I haven't find any resourcees on the internet. An other way to to projections (e.g:for spot lights) is cube map projection. I also didnt find any information about this either! :(

11-30-2004, 11:03 PM
here is a text about the cubemap way:


just implemented it myself, works for perspective projections, but couldnt get it to work with orthographic yet

12-02-2004, 06:41 AM
Cube map lookups are inherently projective.