Hey,
I am trying to do a fullscreen shader which uses a vignette as a mask on the alpha channel. I would like the vignette to be circular and not elliptic.
To achieve this in Shader Graph, I am trying to get the screen position in pixel and divide it by the screen width. According to the Screen Position doc, I would expect this to give a normalized vector with (0, 0)
at lower left corner and (1, h/w)
at top right corner (where h
is the height in pixels and w
the width). Graph + result below:
In this graph, it seems to me that everything works as expected in the preview nodes (see Shader Graph tab). But once in game view, everything is white (see Game view tab).
As a matter of comparison, below is a similar graph but using the already normalized (and centered) position, which - as expected - gives an elliptic vignette (since normalization si done wrt height in vertical axis and not width).
Why is the output of the 1st graph completely white?
Is there something I’m missing somewhere?
Also, maybe this is a hint: as said earlier, my expectations for the 1st graph would be (0, 0)
value at lower left corner and in the preview node one can see that it is actually in the upper left corner, which seems to contradict the doc?
Thanks for your help!