- Home /
Swapping textures / shader of two gameobjects
Hi, I just would like know how could I swap the shader / textures of two gameobjects in order to simulate transparencies. I will explain it better. Imagine that I have 3 elements at different distances: 1) a vertical plane in the background, where I apply a texture based on a picture. 2) An intermediate object with whatever texture (e.g. a red cylinder). 3) A closer irregular surface or terrain. Now imagine that from a certain position the closer irregular terrain hides partially both objects behind (1: the background plane and 2: the red cylinder). What I would like to do is to apply a texture or shader to the irregular surface with the pixels of the background plane that it is hiding, in such a way that apparently the surface is invisible but the red cylinder is also invisible in those parts where it is hidden by the surface. Did I explain myself? Thank you very much for your help.
Answer by vaywatch · Oct 01, 2016 at 04:23 PM
I will reply myself: Follow the instructions provided by this post and you will find the right way to do it: http://answers.unity3d.com/questions/704763/does-anyone-know-how-to-implement-these-depth-mask.html
Your answer

Follow this Question
Related Questions
grouping Textures 1 Answer
select float2 uv_Maintex to UV map channel in shader. 0 Answers
Vertex Color Shader 0 Answers
Cycle through object materials on mouse click in C# 1 Answer