Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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:
    24
    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,491
    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:
    24
    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.