Search Unity

Question Sphere Vertex Displacement problem (in newer versions of Shader Graph)

Discussion in 'Shader Graph' started by Omelette_au_Goulage, Mar 22, 2021.

  1. Omelette_au_Goulage

    Omelette_au_Goulage

    Joined:
    Jun 9, 2020
    Posts:
    14
    Explanation: Following this Sphere shader tutorial:
    , I tried to create the same kind of shader. Following every step multiple times I realized that the output doesn't behave the same way that the one in the video does. The problem seems to be that vertex displacement doesn't match the color of the sphere (black parts should be near the sphere center, white parts further away from the center). I've tried to recreate the shader in Unity 2019.4.16f1 LTS (Shader graph versions 7.3.1 and 7.5.2) and Unity 2020.3.0f1 LTS (Shader graph version 10.3.2). Both not working correctly.

    I noticed that the PBR Master node of my shader graph has different inputs than the one in the video (in the new versions the "Position" input is replaced by "Vertex Position", "Vertex Normal" and "Vertex Tangent"), so I tried to create the shader in Unity 2018.4.32f1 LTS (Shader graph version 4.10.0) and sure enough IT WORKED. I tried copying the 2018 shader to 2020 project, but the result was the same (incorrect) as in previous attempts.
    The first picture below is the CORRECT working of the shader from Unity 2018, the second picture is INCORRECT working of the same shader from Unity 2020.
    2018.png 2020.png

    I've also noticed that besides different PBR Master node inputs, there are some additional graph options. I've tried changing the fragment normal space, but I just can't get the shader to work in newer versions of Unity.
    I am quite new to Shader Graph and I don't know what else to try.

    Expected solution: Since the newer versions have been out for more than a year, I don't believe this is a BUG. I believe this can be fixed by changing the graph settings or maybe replacing some nodes in the graph that might work differently. The solution might be obvious to more experienced Shader makers.

    My Question: How do I achieve the result from picture1 in Unity 2019 or 2020?

    P.S. for potential helpers: The shader in the video shouldn't take you more than 15 minutes to make. If you are experienced you can probably make it in less than 5. (I can't attatch the .shadergraph format to the post)

     
  2. Omelette_au_Goulage

    Omelette_au_Goulage

    Joined:
    Jun 9, 2020
    Posts:
    14
    I have just now realized I can just post a picture of the shader for easy recreation. Here it is: ShaderPNG.png

    And these are the exact parameters that give you the shape on first two pictures:
    ShaderParameters.png

    EDIT: I might also mention that I'm using a ~12K tris sphere imported from blender. It is part of the tutorial in above youtube video.
     
    Last edited: Mar 22, 2021
  3. Omelette_au_Goulage

    Omelette_au_Goulage

    Joined:
    Jun 9, 2020
    Posts:
    14
    Update: I have been observing the behaviour of the shader and I have some new information. If I set the displacement to 0.0 and increase it by a tiny amount you can see that the vertex displacement works correctly (the shphere extrudes at the white parts of the sphere when displacement is 0.0). The problem seems to be the color. Every time the displacement is increased, the color changes position (which doesn't happen in Unity 2018, there it behaves exactly as you would expect: when increasing displacement, the bloated parts of the sphere remain white).
    1-11.png

    I am now starting to think this is in fact a bug.
    Still waiting for shader ninjas to explain the weird behaviour and a potential fix.
     
  4. ENT-

    ENT-

    Joined:
    Jul 26, 2020
    Posts:
    1
    The exact same thing happened to me, have you found a solution yet? Its such a shame because the shader looks great
     
  5. Omelette_au_Goulage

    Omelette_au_Goulage

    Joined:
    Jun 9, 2020
    Posts:
    14
    Haven't found a solution, I am hoping a Unity developer sees this thread.
    It is quite unfortunate because any vertex displacement on a sphere is not achievable right now.
     
  6. zacharyaghaizu

    zacharyaghaizu

    Joined:
    Aug 14, 2020
    Posts:
    65
    Did you find a solution? I was really excited to achieve this affect from Licke's tutorial
     
  7. Omelette_au_Goulage

    Omelette_au_Goulage

    Joined:
    Jun 9, 2020
    Posts:
    14
    I couldn't find a solution so I gave up at some point.
    Thanks for asking tho, it gives this thread a bit more attention :)