- Home /
Projecting a square (or another shape) onto terrain
I am attempting to project a small blue square on the terrain. I tried using the blob shadow projector and switching the texture, as well as using a custom shader (like this one), but it projects the texture across a huge square that is larger than the projector size and not showing the texture correctly anyway. It appears as though the texture is stretched across the entire terrain, and only showing a square of it at a time.
I have the texture's wrap mode set to Clamp, I have used multiple different textures (with and without alpha) and still can't seem to project onto terrain properly. I know I can get the projection to work on a small cube object, but I am seeking to project directly onto the terrain in order to follow the contours. Is there some setting I am missing in the shader def, or is this an issue with attempting to project a color/texture onto terrain?
Is the square not to be projected beneath the character rather than the camera? If so, you should edit the topic of your question.
Well I had meant the camera that is attached to the character, but you are correct that "character" makes it more clear, so I updated it. Thanks for the suggestion!
You haven't set up your light cookie properly. This can cause the projector to project the mesh onto the entire object, not just at the position you have the projector. http://unity3d.com/support/documentation/$$anonymous$$anual/HOWTO-LightCookie.html
Answer by jeango · Aug 04, 2014 at 01:37 PM
Well this post is kind of old, but since it's still unanswered, I'll give it a try.
In the blob shadow projector's inspector, you can set the projection to be orthographic instead of perspective. This way, no matter where your projector is, you'll always have exactly the size and shape you want.