View Full Version : projective texture problem

09-17-2003, 08:23 AM
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?


09-17-2003, 08:29 AM
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.

09-18-2003, 01:01 AM
it seems to be difficult ?

Which methode is faster for rendering?

Is it possible to use a clip plane?

09-18-2003, 01:17 AM
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.

09-18-2003, 03:34 AM
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).]

09-18-2003, 03:37 AM
My projector is the yellow star in the picture.

09-18-2003, 05:59 AM
nVidia have a few examples of projective cubemaps, their old disco ball is one of them.

09-18-2003, 07:32 AM
I have found just one demo in www.nvidia.com (http://www.nvidia.com) which use cubemap to project a texture: "cloud cover", but it requires the NVEffectsBrowser to run http://www.opengl.org/discussion_boards/ubb/frown.gif

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: http://developer.nvidia.com/page/opengl.html
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?

09-20-2003, 01:29 AM
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.

09-20-2003, 05:16 AM
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;

09-20-2003, 06:13 AM
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?

09-20-2003, 06:36 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

09-20-2003, 07:09 AM

09-20-2003, 07:11 AM
But where can i found some documentation about how to use cubemap to project a texture?