Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
ThoughtfishConny's avatar
3 years ago

Transparent Materials render Passthrough through them even though solid object is behind them

Hello!

I am using URP, Unity 2021.3.14, OpenXR Plug-In and Passthrough. Any transparent materials will have Passthrough (on Underlay) shine through, even if it should be blocked by a solid object. It makes everything transparent look grey because of the Passthrough Not using any transparency is not really an option for me. Did anyone encounter this issue and/or has a solution for it?

8 Replies

Replies have been turned off for this discussion
  • RaptorMatt's avatar
    RaptorMatt
    Expert Protege

    I am having the same problem. Is there any solution to this? I'm using Unity URP, with Unity version 2022.3.10f1

    • BogomilPetrov's avatar
      BogomilPetrov
      Protege

      Could you try opening the shader and where it says ZWrite set it to on instead of off?

  • Hey. I had a similar issue when using the Selective Passthrough shader.

     

    I fixed my problem by opening the shader code and setting Z Write to on. I found that when it was off none of my transparent materials rendered over the passthrough at all.

  • RaptorMatt's avatar
    RaptorMatt
    Expert Protege

    Hmm, thank you for the suggestion BogomilPetrov - that is good to know for Selective Passthrough but unfortunately that doesn't seem to help with Background Passthrough. ☹️ I went through all the Meta-provided passthrough shaders and made sure ZWrite was set to 'On', but got the same result. I also turned on ZWrite for my own UI shader (it's a custom UI overlay shader) but that didn't do anything to help either. Any UI that has transparency has passthrough rendered through it, regardless of whether or not there is an opaque object behind the UI. ☹️

  • RaptorMatt's avatar
    RaptorMatt
    Expert Protege

    I should note that this bug also exists with Meta's own shaders/materials. For example, the "stylized hand" shader (the "OculusHand" material) included with the SDK suffers from this issue. If you have a passthrough scene with a solid 3D model, and you hold your semi-transparent "stylized hand" on top of the 3D model, you'll see passthrough rendered through the semi-transparent hands even though there is a solid 3D model behind the hands.

  • RaptorMatt's avatar
    RaptorMatt
    Expert Protege

    Per the suggestion of markeahogan, setting the blend mode to

     

     

    Blend SrcAlpha OneMinusSrcAlpha, OneMinusDstAlpha One

     

     

    fixed the passthrough transparent rendering bug for my own transparent materials. If the issue still exists for any default Unity transparent materials though, then Meta should see what they can do to fix it, or at the very least write some documentation about the problem. I had to duplicate and modify their 'OculusHand' shader in order to edit the blend mode and properly render their 'stylized hand' models with no passthrough rendering bug.