I need how to make a gradient that smoothly transitions from white to transparent for a 2D sprite via a URP shader graph.
It seems like I’m already set up and everything should work, but for some reason the sprite turns from light to black, and not transparent. Why might this happen?
https://drive.google.com/file/d/1S2ujMkqJ0r9ZB50QVB6OcBTEBp1BXzRZ/view?usp=share_link
https://drive.google.com/file/d/1xd9SMzaubjaQzG7mazYIkVvuuDkmdzJn/view?usp=share_link
BaseColor
accepts only a Vec3
, you have a Vec4
. Your Alpha
output is set to 1. The result is: You only see the lerp of the first three members of your color (RGB), because the value is truncated to a Vec3 implicitly (see the gradient on the connection from pink to yellow).
If you want to also see the alpha of the lerp, you need to split the outputs (e.g. with a split node) and connect the A value to the Alpha
output.
Unrelated note: Lerping from RGBA(1,1,1,1)
to RGBA(0,0,0,0)
can leave undesired grey artifacts. You may want to lerp between RGBA(1,1,1,1)
and RGBA(1,1,1,0)
instead. Or just lerp between 0 and 1 for alpha and use a single color.