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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Fake Liquid on Shader Graph : blending back faces and front faces rendering.

Discussion in 'Shader Graph' started by ulysseC, Feb 27, 2020.

  1. ulysseC

    ulysseC

    Joined:
    Sep 23, 2017
    Posts:
    2
    Hello, I am new to Shader and Shader Graph. However, with some help I've found on the web I managed to rework a fake Liquid Shader. Unfortunately I run into an Issue.
    This is where I am:
    upload_2020-2-27_14-44-21.png
    The shader is opaque and use refraction and reflection to fake the liquid transparency. The model is a solid sphere and it is cut out by the shader.
    I would like to acheive this effect (seeing part of the back faces behind the front faces):
    upload_2020-2-27_14-48-22.png
    I think it would be something like if the back faces were rendered first and then the front faces would be blended in overlay on them. I can't figure out how I can make that. And I try to avoid making the shader Transparent. Because I don't want to lose the refraction effect.

    Does anyone more qualified than me have an idea on the process to follow?

    (Sorry for my awful english... I'm French and I try my best...)
     
  2. lostminds

    lostminds

    Joined:
    Jan 17, 2019
    Posts:
    51
    I've run into the same problem, but I haven't found a clean way to do this in shader graph as it doesn't seem to support doing multiple passes in one shader (like first the back and then the front faces) and weirdly there's no way to just draw back faces (you can either select front or both).

    You can work around it like this:
    https://forum.unity.com/threads/lwrp-shader-graph-how-do-render-back-faces.671644/#post-5889029
    But it's a bit of work and I really wish Unity could just add separate backside/frontside/both passes in a single shader.

    EDIT, this might also be helpful: https://forum.unity.com/threads/lwrp-shader-graph-transparent-two-sided-problem.685534/#post-5210591
     
  3. ulysseC

    ulysseC

    Joined:
    Sep 23, 2017
    Posts:
    2
    Thank you very much for your answer. I was starting to despair.

    Unfortunately I already use the Is FrontFace trick (link 1) to render the back part of my liquid but my shader lacks a two passes system to allow the blending for the front part. It seems that's the multiple passes are not supported either by lwrp or hdrp and that Shader Graph is not reponsible for this limitation.

    I'll try the second link tipps.

    However, I also hope that unity will diversify the included parameters of Shader Graph because it currently suffers from multiple limitations.