getting a Projector to behave like a real world Projector?

Hi,
i`m trying to get a projector to behave like a real world projector, i managed to project the texture on an object with this extremely simple shader:

Shader "Projector/Texture" {
  Properties {	
     _ShadowTex ("Base (RGB)", 2D) = "" { TexGen ObjectLinear }
  }
  Subshader {
	  Tags { "RenderType"="Opaque" }
      
      Pass {
         SetTexture [_ShadowTex] {
            Matrix [_Projector]
         }
	  }
   }
}

this looks exactly the way i want it to be when the camera is in the same position as the projector. My problem is that the texture is applied to all surfaces within the frustum of the projector not taking into account the line of sight of the projector. When i move the camera it looks like this:

The object looks like this (please ignore the Lights):
515165--18304--$Bildschirmfoto 2011-03-04 um 13.19.24.png

what i want to achieve is that the texture is only applied to surfaces within the line of sight of the projector and having no texture on everything that the projector cant “see” (for example the wall behind the pillars).

I have tried to do some ZTests in the Shader but they always refer to the current Cameras Depthbuffer for testing and not to the Projectors Buffer.

Any help would be very much appreciated.

David

Apply the texture as a cookie to a shadowed light. There isn’t really anything you can do about the way projectors work.

thanks for your reply.

the problem with cookies is that they only use the alpha channel so i cant use them for projecting my texture. There is a thread on projected shadows dating back to 2006 http://forum.unity3d.com/threads/2470-Projected-shadows-for-the-characters! that could be a solution but i couldnt get that to work in my setup (Unity wont import the package).

David

Might want to take a look at this. I have not tried it but I use more or less the same thing of water reflections.
http://forum.unity3d.com/threads/33500-Projectors-projecting-too-much?highlight=projector+projecting