Projected Textures (dumb question about)

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?

Thanks.

Texture clamping will happily solve that problem for you.

– Tom

I’ll go look that up - how exactly does that work?

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.

Thanks.

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.

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

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

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

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

Tom,

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 -
Cass