Orthographic projector spills outside of its bounds

When using a projector in Orthographic mode, the cookie I am using is rendered well outside of the bounds of the projector. This happens when I use any cookie other than a circular image on flat black. You can see how it is set up and how it displays below. The projector object is selected and you can see the extra grid lines being projected to the left of the projector box.

41279-scene-view.png

Is this normal behavior? I’ve been looking, but my google-fu is failing me. Maybe I don’t know what to search for, exactly. Is there a way to prevent the cookie from spilling over the bounds of the projector?

I found the solution to my problem. After playing around with it for a while, and examining the light projector prefab that comes with the standard assets, I found the correct way to set it up.

When creating the texture file:

  • Make the texture 1 pixel wider/taller than you want to use. (The excess will be trimmed off, I think by the Border Mip Map setting below)
  • Put a border 1 pixel wide of black along all edges (Must be RGB 0, 0, 0)
  • Put the image you want to use inside this border. No part of the image should overlap the border. Touching it is fine, but you cannot overlap.

An example: It may be hard to see, but there are black and white borders along the outer edges. The white border is only used to show the black border.

41416-bordered-projector-cookie.png

Once you have your texture file created and imported into Unity, specific texture settings have to be set to make it work. Locate the texture being used in the Project panel and set it as follows.

  • Texture Type: Advanced
  • Generate Mip Maps: checked
  • Border Mip Maps: checked
  • Wrap Mode: Clamp

Click Apply and use the Projector/Light shader with your texture and it should remain within the bounds of the Orthographic Size of the projector.

I have not tested this with perspective projectors. They may work differently.

This may have been obvious to others, but my understanding of graphic assets is pretty limited. I put my answer here so that if anyone else has a problem like this, here’s the answer.