- Home /
Shader Graph restricted Billboard to one axis
Hey guys,
Can you help me out with "billboarding" a quad so that it can still be stretched forward with z axis scale. Goal is to have it face the camera / view but be transformed what would be a local z rotation.
I started of with the mentioned billboard shader resulting in translating everything as if it was rotated on x by 90 degrees. I cant figure out how to keep if flat like the one next to it seen here on the second screenshot.
Picking up from here: (thanks for pointing out new question @andrew-lukasik )
Answer by andrew-lukasik · Feb 02 at 10:27 PM
This graph will rotate a default Plane mesh along it's Z axis to always face the camera (local Y+):
preview:
mesh scale is
(1,1,2)
hence a rectangle
BillboardZ.shadergraph.zip
Thanks Andrew! I am investigating today to give you a proper feedback here.
FYI: This takes so much longer than expected. For whatever reason unity is doing "nothing" with the shader on screen. I saw it working only one time.. idk why - cannot replicate. No errors besides the implicit truncation warnings from shader graph. So I get the very latest 2020.3 now and set up a new project to have a second look at it.
Idk, this is my shadergraph file: BillboardZ.shadergraph.zip (RMB/save file as). Works fine on my computer :T
File is from Unity 2021.2 / URP / Shader Graph 12.1.4
Andrew сan you suggest how to change this shader so that it is applied to each polygon instead of the entire mesh? Like grass on Terrain. I'm assuming it should be about Tangent Space, but I still can't get it right. Sorry for my stupidity, I'm new to Unity and really need some advice! Thanks.
You either need a geometry shader or a pre-calculated rotation pivot/vertex to do that. Geometry shader is available from HLSL not Shader Graph. I suggest looking into geometry shaders.