View Full Version : Projected Textures (dumb question about)

06-25-2002, 03:03 AM
Just wondering what happens if the projection `square' is smaller than the triangle\quad you are projecting on to. How is it possible for the projected image NOT to fill the entire primitive (alternatively, I've totally misunderstood projected texturing).

For example, I project a TV screen image onto a wall, only a small square on the wall should be rendered with the image covering it, but projected texture algols' seem to just generate texture coords for the wall, based on the position\direction of the projector. How does this work?


Tom Nuydens
06-25-2002, 03:18 AM
Texture clamping will happily solve that problem for you.

-- Tom

06-25-2002, 03:32 AM
I'll go look that up - how exactly does that work?

06-25-2002, 03:38 AM
Ok, ok, I got it. The texture unit ignores values outside of the clamp range if clamping is switched on - resulting in a kind of decal texture.


06-25-2002, 03:39 AM
for every fragment you get the linear interpolated texcoords. they get divided through z (or w?) at every fragment. so you get your texcoords. these are then clamped, if clamping is set, or repeated, if repeat is set.

any value bigger than 1 will be set to 1
any value smaller than 0 will be set to 0

texcoord = fraq(texcoord) == texcoord - floor(texcoord);

06-25-2002, 03:54 AM
So in order to get that `decal' effect, you have to give your textures a blank border.???

Tom Nuydens
06-25-2002, 07:18 AM
Originally posted by Robbo:

So in order to get that `decal' effect, you have to give your textures a blank border.???

Yes, or you could use GL_CLAMP_TO_BORDER. However, if I recall correctly this isn't accelerated on GeForce (I don't know about other cards).

-- Tom

06-25-2002, 07:56 AM

Hardware support for border texels is going to be turned on "pretty soon" for GeForce3 and GeForce4 Ti. You can already use border color with GL_CLAMP_TO_BORDER, which should be sufficient for this purpose.

GeForce 1, 2, and 4 MX do not have hardware support for borders or border color.

Thanks -