solve reverse projective texure (q coordinate method)

hi,

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

If you are using fragment shaders, just do:

 if (texCoordProj.z<=0.0)
	       discard; 

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 ?

thanks
I really need to fix this

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.

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.

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! :frowning:

here is a text about the cubemap way:

http://www.ronfrazier.net/apparition/research/per_pixel_lighting.html

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

Cube map lookups are inherently projective.