projective texture problem

I have tried to project a texture in a scene.

It works, but, i have a problem:
My texture is projected in front of the projector and behind the projector.

I just want to project my texture in front of the projector (like a real projector).

I have read somewhere that it’s noraml and this is not a bug.
But is there a way to project a texture just in one way?
And How?


There are some tricks to make… 1 is to use a cubemap instead, then you can define all directions, or use multitexture and a small 2 pixel texture, one black and one white pixel, and set up the texture generation for that textureunit so that it cast the white pixel forward and the black backwards and moduate with the first texture.

it seems to be difficult ?

Which methode is faster for rendering?

Is it possible to use a clip plane?

The cubemap technique takes a bit of memory ( 6times as much) but should be easest to implement, and you have much more freedom. look at nvidias site for examples.

i have read the the Nvidia CubeMap documentation, and i think i have not used the good words to explain my problem (english is not my mother tongue, sorry). Because i don’t know how CubeMap can solve my problem.

I would better to use “projected texture” instead of “projective texture”.

I want to project a texture like a movie in a cinema. I don’t want to use reflection.

My problem is that my projector project my texture in front of and behind the projector, as you can see in this picture:

[This message has been edited by greg2 (edited 09-18-2003).]

My projector is the yellow star in the picture.

nVidia have a few examples of projective cubemaps, their old disco ball is one of them.

I have found just one demo in which use cubemap to project a texture: “cloud cover”, but it requires the NVEffectsBrowser to run

I have also found some demos about cubemaps, but they use it for reflection or bumpmapping, and not for projecting a texture.

I have gone in this web page:
Is there an another place where i can find other demos?

Where can i found the demos about projective cubemaps?
Do you have some links which can help me to found it?

i don’t have found any demo about how to project a texture with cubemap (in the Nvdia website or in google).

i have read several documentations about cubemap, but it just explains how to use it for reflection or Bumpmappin.

I don’t understand how it can be used for projecting a texture like a projector of movies.

Please help me.

I can’t tell you a general solution for the problem, as I have little experience with it. However, I can tell you the cause.

Behind the projector, you are getting texture coords with negative r and negative q components.
For lookup purposes, the final texcoord will be (s/q;t/q;r/q) (interpolated w plays a role, too, but let’s keep it simple).

That means behind the projector, you’ll get the image in front of the projector (r/q>0), and flipped. This is an inherent problem of cubemap addressing with homegenuous coordinates.

You can try the modulation trick to black out textures behind the projector.

You can also try a user clip plane.

It might also be possible to play with the texture projection matrix to always output a constant, small positive z (just a wild idea). If that actually works, it would prevent the front-to-back flipping when w crosses zero.

If you’re using ARB_fragment_program, you could

KIL fragment.texcoord[0].w;

Ok. I will try to use a clip plane.

But you write:
“This is an inherent problem of cubemap addressing with homegenuous coordinates.”

I don’t use cubemap to project my texture.
You and Mazy speak about cubemap. Why?

Oh, sorry, got confused about that one. I somehow thought you were using cubemaps.

As I said, I don’t have much practical experience with this stuff.
If you don’t use cubemaps, the “constant positive z” trick will not work.
A clip plane should be fine


But where can i found some documentation about how to use cubemap to project a texture?