2

My shader code is:

Shader "Custom/Transparent" {
     Properties{
         _Color("Main Color", Color) = (1,1,1,1)
         _MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
     }
     SubShader{
         Tags {"RenderType" = "Transparent" "Queue" = "Transparent" }
         Blend SrcAlpha OneMinusSrcAlpha
         ZTest Always
         Pass {
             ColorMask 0
         }

         UsePass "Transparent/Diffuse/FORWARD"
     }
     Fallback "Transparent/VertexLit"
 }

and I only can get this result: enter image description here

The finger is pointing down: enter image description here

What I really want to achieve is this: enter image description here So the hand is transparent but it does't show itself just the object behind it. What can I do?

EDIT 1: I tried to change "ZWrite" to "On" and restart Unity but it had the same result, the hands are Oculus Hands. The problem in particular is that I have "ZTest Always", when I remove it, it already works but I additionally need that the ghostly hand can be seen between solid objects so I cannot remove that part

1 Answers1

1

To achieve this, you will need to enable depth buffer writing by adjusting the ZWrite option that you have to "Off" as so:

Pass {
         ZWrite On
         ColorMask 0
     }

More reading on the subject you can find here

https://docs.unity3d.com/2020.1/Documentation/Manual/SL-CullAndDepth.html

Vect0rZ
  • 401
  • 2
  • 6
  • I tried it, changed the "ZWrite" to "On" and restarted Unity and in the editor keeps happening the same, should I do something else? – María Román Oct 05 '21 at 06:10
  • I have found the problem, putting the "ZWrite On" already works but I have to also remove the "ZTest Always" and I need it since it gives an effect that the hand is visible through solid objects, but if I put it in Always it cancels the effect of ZWrite – María Román Oct 05 '21 at 09:17