- Home /
Projecting a texture from plane to object
Hey, I'm trying to project a texture from a plane to a wall using raycasts. This should happen in realtime. Since the plane is larger than the wall, only part of the texture is supposed to appear on the front side of the wall. So moving the plane will also change the part of the texture on the wall. The wall can have windows etc so it's not just a simple cube. I already managed to get the texturecoordinates using raycasts, but I haven't yet managed to correctly put the texture on the wall. Any ideas how I might achieve this?
Answer by echo4papa · Dec 10, 2015 at 05:24 PM
I'm pretty sure one way to do is like this:
Write your raycast UV to an open UV channel on your target mesh, and in a custom shader draw that texture with that UV channel.
A better way might be something like the deferred decals example here: http://blogs.unity3d.com/2015/02/06/extending-unity-5-rendering-pipeline-command-buffers/
Your answer
Follow this Question
Related Questions
Painting on a texture without crossing mesh triangle. 1 Answer
Selecting a pixel on a spheres texture via click 0 Answers
Spritesheet animation from a projector 0 Answers
Sphercast hitinfo TextureCoord rounded? 1 Answer
Get Texture Coordinates from a Plane when a Mesh or object Intersects/Collides 2 Answers