Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Can't get transparency to look right?

Discussion in 'High Definition Render Pipeline' started by SpookyCat, Nov 29, 2023.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    I have a simple mesh which is a cone inside another one and I want to be able to see the multiple layers but I just get the outer shell and cant see the polys under it. This works just fine in Builtin and URP but I can't get it to work at all in HDRP, I must be missing something obvious but I have been through every value and nothing makes it look correct. Anyone have any pointers as to where Iam going wrong?

    Below are a couple of screen shots showing the mesh from a couple of angles so you can see you cant see under the outer layer of polys. And one of the material values in case someone can spot the silly mistake Iam making.
    Screenshot 2023-11-29 220005.png Screenshot 2023-11-29 220024.png Screenshot 2023-11-29 220109.png
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    749
    Hey, you can't stack multiple layers of refractive transparent in the same render pass in HDRP.

    If you want to be able to see the "inside cone" through your "outside cone", the inside one needs to be rendered into the "before refraction" pass. (see gif).

    6fc0f3409a542773c091ce1f83e9ac0b.gif

    As for stacking multiple layers of NON refractive transparent, as @Remy_Unity said, the object need to not write their depth, so Depth Write needs to be off (same for transparent depth prepass which is a prerequisite for SSR on Transparent as well)
     
  3. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    685
    You probably need to disable DepthWrite in the material settings.
     
    chap-unity likes this.
  4. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    591
    Here I came to answer this ( a very slow response time from me today) and instead I learn that Chap has Foresight on Remy :D, unless a post was removed, but let's not spoil the possibilities here.

    Great insight though, I didn't realise the before refraction pass could layer this well are we able to view this in the frame debugger/Render pipeline debug as well? That could really come in handy.
     
  5. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    In the end I had to fix it by changing the mesh so the outside polys came first going in towards the middle, though I cant understand how BuiltIn and URP handle this with no problem at all but HDRP has an issue.
    Also on another issue with HDRP transparency it can sometimes handle stacked objects and renders right but then change a view a bit and suddenly a transparent object in front blocks the mesh behind from rendering. You can see the issue in the video below. I have tried changing all the transparency prepass etc settings but nothing fixes it. Again this is something BI and URP handle with no issues at all but HDRP no chance.

    Any suggestions on a way to fix this basic sorting issue? Can HDRP not handle simple layers of transparency? Any ideas?
     
  6. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    685
    Did you try to disable depth write like I suggested ?
    What seems to happen in this video is that because transparent objects are rendered from back to front, at some angles the bursts from the wings are rendered first, and because they have depth write, it is effectively blocking the other transparent pixels where depth is further way to be rendered.
     
  7. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    Thanks for the help, think I finally have the shader and system sorted on HDRP. Bit over the top with the Post Processing will do a more sedate version but it's looking like it will work out nicely on HDRP. Thanks again.
     
    chap-unity and Lurking-Ninja like this.