- Home /
Just A Projected Texture, Not Shadow Or Light
All I want to do is to project a texture using a projector, and have the texture placed in the spot where the projector is aimed, not have the single texture wrapped around the whole mesh. I also want the texture to look exactly like it should, so the color should stay the same and not be transparent, unless there are transparency in the texture.
I mean, I want it to work similar to how a projector actually would, but that seems too logical.
Answer by Pangamini · Jan 14, 2014 at 06:37 PM
What projector does is that it renders everything in its frustum with some material. It also pushes a projection matrix to the material shader.
To achieve an effect that the texture is projected, you need to use a shader that will render it properly. You need a Projection/* shader. I think supplied ones only do additive(light) and multiply (shadow?) rendering, but you can basically write any shader you want.
Here's link to a question about projection shaders if you need help with that.
"color should stay the same and not be transparent, unless there are transparency in the texture"
From what you said, you will probably need alpha blending, although you also said
"I want it to work similar to how a projector actually would"
in which case the standard light shader should work (as actual projectors are actually lights, that's why you use them in the dark room ;) )
I hope this helps
The problem for me is that I have no idea how to write a shader. Or course, I could learn how to do it, but I rather just focus on JavaScript. So I hoped there would be a proper projector shader, which I thought wouldn't be so hard to find.
The light projector made the color very dull, it uses gray scale for transparency and it goes through multiple objects. Layers could be used, but not in my situation as I'm using a player model, so if the projection hit the side of the body, it will also hit the side of the arm behind the body.
It does not use gray scale for transparency, it simply sums the color of projected texture and whatever's underneath. Simple blending option in the shader could fix this.
For the other problem, i'm afraid it is going to be more complicated. You need to create shadows for the projecotr somehow, and that's not a built-in feature AFAI$$anonymous$$. Lights support having a cookie, which works kinda like an additive projector, but i think cookies are projected as grayscale only. Basically, you will need to implement your own shadow rendering for this. Or at least there's nothing i'd know about. Try asking on the forums, perhaps there's a way how to reuse some unity's shadowing
Answer by Owen Burk · Jan 14, 2014 at 12:17 AM
If you have Unity Pro you could have the texture somewhere else with a camera facing it and use a rendered texture.
http://docs.unity3d.com/Documentation/Components/class-RenderTexture.html
I will need to put it on top of an another texture where the surface is not necessarily flat. So it doesn't seem like that would work, but it could be great for other things, so thank you for pointing me to it.
Answer by Darkroot-Jackson · Oct 25, 2018 at 05:26 PM
This is incredibly easy in Maya.. Im amazed how hard this is in Unity. Has anyone solved this yet?
Your answer
Follow this Question
Related Questions
camera for rendering and realtime projection 0 Answers
Blob Shadow and Trees Using Terrain Cause Issues 0 Answers
Projecting Texture to Mesh 0 Answers
Baking/Mapping projection texture into object texture 0 Answers