Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: clipping backface projection in projected textures

  1. #1
    Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    267

    clipping backface projection in projected textures

    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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    612

    Re: clipping backface projection in projected textures

    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.

  3. #3
    Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    267

    Re: clipping backface projection in projected textures

    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).]

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: clipping backface projection in projected textures

    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

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    612

    Re: clipping backface projection in projected textures

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •