Search Unity

Question Billboard Shader URP

Discussion in 'Shader Graph' started by paulindrome, May 14, 2020.

  1. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    After googling three different solutions to this problem and wasting hours on it with last-ditch trial and error efforts I've decided to give up and request the help of people more patient and intelligent than me in the ways of shader magic.

    Below you can take a look at the different attempts. I am beginning to suspect something might be wrong with my mesh. It's made with ProBuilder and is basically just a circle (the top of a cylinder) with an X made of 4 faces on top of it, rotated -90 degrees on the X-axis to have it stand upright on the edge.

    The right-most note of each attached shader graph would then lead to the Vertex Position input of an Unlit Master node.

    Screenshot_11.png Screenshot_12.png Screenshot_13.png

    Unity 2019.3.9f1
    URP 7.3.1
     
    lilacsky824 likes this.
  2. alexandersyurchenko

    alexandersyurchenko

    Joined:
    Oct 29, 2019
    Posts:
    9
    I actually have the same issue as paulindrome with creating billboard shaders in shader graph. There seem to be so few quality solutions out there for this that ACTUALLY work...

    I've tried some of the same solutions you've tried. Ended up with this variation (attached bellow). It works for a mesh that is just a single quad. But as soon as I have many quads in a single mesh it starts rotating funny (as illustrated in the video).

    Has anyone figured this out? I'm pulling my hair out...

     

    Attached Files:

  3. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    I have currently resorted to using a script to rotate the entire object in the direction I need.

    Code (CSharp):
    1. public class RotateTowardsCamera : MonoBehaviour {
    2.     Camera main;
    3.  
    4.     void Awake() {
    5.         main = Camera.main;
    6.     }
    7.  
    8.     void Update() {
    9.         transform.LookAt(main.transform, Vector3.up);
    10.     }
    11. }
    Which just feels cheap and doesn't scale. Lucky for me, it's only a few objects in the scene and no big deal. Still, a working billboard shader should be something easily achievable with Shader Graph but for some reason, it eludes me.
     
  4. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,383
    This one worked perfectly for me



    Edit: Ah, I see that you have this solution in one of your screenshots..
     
    d_gul and Sarisarinyama like this.