Hey so I'm creating a UI thing for a game and I saw TMP has a vertex gradient thing for a 4 corner gradient for its text, so i wanted to give the box background i gave it the same sort of gradient so I made this:
Problem is it doesn't really feel like I'm 50/50 lerping the colours? at first I wasn't using a multiply node and it was super obvious the colours weren't linearly lerping 50/50 so i added one and it's better but am i missing a way to lerp colours "properly"?
#Trying to recreate 4 corner vertex gradient into shader graph
1 messages · Page 1 of 1 (latest)
What kind of color blending do you have in mind?
There's many ways to represent color, and to blend it too
The mathematical interpolation rarely matches our perception of colors
each colour would have control of its corner and it'd fade into the other colours as it goes outwards
ideally the same as how TMP does it but the screenshot i sent is kinda close but i can tell the colours arent blending 50/50 by looking at the black and white representation
here's a cleaner view of it not looking right, where one corner is dark red, one white, and other two black, it feels like the bottom right corner doesnt start out with enough white on it, same with bottom left the red isnt as strong as i'd expect
What color value for red is used here?
but ill switch it out for pure red and rescreenshot
this also feels like it should be working without me needing to feed a multiply node a specific number like i saw in another video
without the multiply node it looks even more off lol
Also, is your project using gamma or linear color space?
unsure, where could i check?
Edit>Project Settings>Player>Other Settings>Rendering>Color Space
yea its linear
if possible i'd prefer a solution that would keep it like that, i cant edit some of the project settings cuz of some restrictions i have
Do you know if the UI is affected by any post processing in this image? Or in game
Screen space overlay canvases would not be
it's in prefab mode and says screen space overlay canvas so i assume not
the shader is also HDRP/Unlit cuz i couldnt think of any other shader i would use if that is a problem
Test it through a game camera just in case
Prefab mode may take post processing from a camera if a scene is open behind it, and afaik HDRP always uses some default profile
Scene window also renders screen space canvases in world space so it doesn't exclude them from post processing
would just setting it up in my "Game" view in the specific scene where it'd normally show up be fine?
You should always preview UI through the Game window if that's what you mean
As it's camera dependent and scene view is a different camera
yeah it seems to still be the same way (ignoring the fact i gotta do something later to make it transparent for the text behind it lol)
Correction, screen space - overlay, not camera
Camera includes post processing, overlay excludes it
huh, turning it into overlay instead of camera does this, that doesnt feel right lol
That's actually expected
oh okay
Shaders used on overlay canvas objects should have the Canvas graph type
Sprite Unlit might work partially if Canvas is unavailable
(but I'd expect them to break / not support canvas features properly)
Not exactly
okie
Which Unity version do you have?
2022.3.9f1
So if I recall correctly that one does not support Canvas graphs
You can see how far you get with Sprite Unlit instead
Or use a camera space canvas and deal with the fact that the camera's post processing and tonemapping are also applied to your shader
hmm so its the post processing and tone mapping causing my stuff to look like that?
I think so
In my end the shader on the canvas looks exactly as it does in SG previews
Unless I enable color correction effects for the camera while using camera space canvas
Multiplication by 0.5 is not necessary and will make the gradient less correct
But you can use multiplication, power or any other operations that seem to work to offset the effect of the post processing