Shader code implementation on sprite looks funny

Godot Version

4.5 stable

Question

I wrote a simple gradient shader but when it's applied to the sprite it looks a bit off. You can see in the material preview the gradient looks good but when applied to the sprite with the same square ratio the black portion looks squished. I also implemented this code in Shadertoy and the gradient looks normal there. Is there a setting I'm missing or something?

Why are you setting the red channel to between 1.0 and 2.0? What happens if you just do:

void fragment()
{
  COLOR = vec4(UV.x, 0.0, 0.0, 1.0);
}

If you look at that line of code, I’m actually doing exactly that as I’m using the UV.x in the COLOR not my custom myUV as seen in the lines of code above. Those are for future tasks I’m working on.

Here is the standard RG shader gradient, looks different right?

Are the UVs on the sprite unusual, perhaps? Or is it blending with something?

Try disabling HDR for 2D viewports in project settings, or linearize your shader output using:

COLOR.rgb = mix(
	pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)),
	COLOR.rgb * (1.0 / 12.92),
	lessThan(COLOR.rgb, vec3(0.04045)));

BINGO! It was the HDR 2D setting. I unchecked it and now it looks perfect. I was previously trying out bloom effects and I think I ticked that setting on for some reason. Thank you so much for the help, the both of you.