I want to make an object to appear semi transparent when it is behind walls so that the camera would still be able to render it but in less solid form. Does this have to do with shaders or raycast? I not sure on the right keyword to search for the problem or even where to start. Hopefully someone could point me to the right direction. Thank you.
This might be a stupid thing to ask, but I can't help my curiosity - Why is the object visible in the first place, if it's behind a wall? Is the wall itself transparent?
I want it to be visible because the object is some sort of guidance to the player so that the player knows the location of the object wherever they are. The object is solid if the camera looks directly at the object and the camera would render it semi transparent when behind walls (will render through walls).
Answer by Waz
Aug 08, 2011 at 09:52 AM
Shaders. Basically, you need to render the object with two shaders: the normal material and one with an inverted Z test (as well as whatever glowing rim lit transparent whatever effect). Keywords:
ztest greater shader
Try to make something with the Strumpy Shader Editor, or modify an existing shader source. This is a good simple intro to Shaders. You'll find they're quite fun.
Thanks for the answer, will try it!
Note that to render with two materials, you can just give it two materials in the MeshRenderer.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
4 People are following this question.
UI masking in a jet fighter HUD
how to change progection matrix for some objects
Render group of objects in front?
How to only render things behind a mesh.
Do transparent objects render?