Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Reveal Shader : Semi transparent objects for unknown reason

Discussion in 'Shader Graph' started by RedGirafeGames, May 5, 2021.

  1. RedGirafeGames

    RedGirafeGames

    Joined:
    Sep 30, 2016
    Posts:
    32
    Hi,

    I'm making a reveal shader (the alpha switch from 0 to 1 based on a distance), it's working quiet fine but I have some of my objects that half dissolve depending on the view.

    Edit : In fact I reproduce with just an Empty Graph with surface set to Transparent... disturbing...
    Edit 2 : Ok now that I narrowed the problem I found threads explaining the simpliest solution is to use opaque with alpha treshold as transparent surface has z depth sorting problems... Works for me.

    For example here is a cylinder with the shader, it's ok:
    RevealShaderOK.png
    But If I move a bit the Camera it becomes semi visible (lighting is baked)
    RevealShaderKO.png
    And the reveal effect is working fine when I set the distance :
    RevealShaderDissolve.png


    Here is the shader graph :
    RevealShaderGraph.png

    The objects have no scripts on them, so it's not a code side effect.

    The ground uses the same shader, and it looks like from some view it is rendered in front of the cylinder while it should be behind...

    I guess I don't understand a transparent or clipping shader concept... any help please?

    Thanks,
    Thomas
     
    Last edited: May 5, 2021
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Instead of marking something resolved, perhaps you could share the solution? If your edit 2 is the answer, it might better to just answer to your own question so that it's obvious what the solution was.That way you could help others.
     
  3. RedGirafeGames

    RedGirafeGames

    Joined:
    Sep 30, 2016
    Posts:
    32
    Here is the answer in case my edits confuses anyone else like Olmi :

    Answer :
    The problem is that I used "transparent" surface mode for the shader, and transparency has z-depth sorting problems (resulting on the ground rendered in front of the cylinders sometime). The simpliest solution (found in another thread) is to use "opaque" surface mode with alpha treshold.
     
    Olmi likes this.