View Full Version : clipping backface projection in projected textures
Bruno
04-11-2003, 01:53 AM
Hi
Any ideias on how to do this ?
I was thiking in using a cubemap, all faces white, with one single face black, so that everything behind the projector is clipped., but i'm having some problems using a cubemap while multitexture is enabled..
Any other ideias ?
thanks,
Bruno
Cubemaps and multitexture should work just fine, but else use a vertexprogram that just flips texturecords from 0 to 1 when the normal faces from the light and use a 1*2 texture with one white and one black pixel.
Bruno
04-11-2003, 02:13 AM
Well, can you spot something wrong with this setup ? tex1 for cubemap, tex0 for projected texture.
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, Cube_Clipper.data.data);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE0_ARB, ProjTex.data.data);
[This message has been edited by Bruno (edited 04-11-2003).]
Tom Nuydens
04-11-2003, 02:26 AM
Originally posted by Bruno:
I was thiking in using a cubemap, all faces white, with one single face black, so that everything behind the projector is clipped.
You would need a cubemap which is half black, not 1/6th black. The back half of the side faces has to be black as well.
However, if I were you I would forget about the cube map altogether and go with Mazy's suggestion of using a 1x2 texture, making sure that everything behind the camera maps to the black texel.
-- Tom
Reflection mapping? and texturecoords enabled?
shouldnt you generate coords from the normals (GL_NORMAL_MAP_ARB i think) and make use of the texturematrix to rotate the cube to the correct angle?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.