PDA

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



equentric
11-24-2004, 12:09 AM
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

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

if (texCoordProj.z<=0.0)
discard;

equentric
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 ?

thanks
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.

cass
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.

unreal
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! :(

CrazyButcher
11-30-2004, 11:03 PM
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

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