Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Oculus basic hand shader glitch

Discussion in 'Shaders' started by wyrrhcyn, Feb 28, 2021.

  1. wyrrhcyn


    Dec 16, 2016
    Hi, I am trying to setup Oculus/Hands_Transparent shader but when I increase Rim Power i have such a ugly glitch. Anyone know how to get rid of it? It is transparency problem I guess
  2. bgolus


    Dec 7, 2012
    Just that. This is a pretty standard problem with transparency.

    The solution that Oculus themselves use for their own desktop applications is to use a two pass shader. Render the hands once only to depth, and render again with the transparent shader.

    You can read about the implementation they use for Unreal engine here:

    For Unity it can be done in a more straight forward way with a two pass shader. This technique is even covered in Unity's own documentation (though buried quite deep were few people see it). Scroll down to "Transparent shader with depth writes":

    The latest Oculus avatar shaders for Unity should have this implemented already, though the original oculus hand shader did not. Not sure if they're both included or not with the default package as I've never used any of the shaders Oculus provides.

    However it should be noted that on mobile the two pass technique is extremely expensive. Transparent materials that depth write are a much bigger performance impact than they are on desktop. For Falcon Age I had to remove the depth only pass as if the user's hands were visible in this "ghost" form we could not maintain the framerate even in simple scenes and with dynamic resolution implemented. So our ghost hands on Quest are using an additive shader with depth writes disabled.
    ElasticSea likes this.