godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.06k stars 21.18k forks source link

Visual Shader Albedo appears desaturated/lightened from Color variables, except when using ColorParameter with Qualifier set to Instance (Vulkan Forward+) #84059

Open wawaboopboop opened 1 year ago

wawaboopboop commented 1 year ago

Godot version

v4.1.2.stable.official [399c9dc39]

System information

Godot v4.1.2.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 31.0.15.3699) - AMD Ryzen 9 5900HX with Radeon Graphics (16 Threads)

Issue description

VisualShader ColorConstant appears washed out compared to ColorParameter Instance

Steps to reproduce

Minimal reproduction project

ColourTest.zip

Calinou commented 1 year ago

This is likely a sRGB/linear conversion issue.

jsjtxietian commented 1 year ago

With color const the generated shader code: vec4 n_out2p0 = vec4(0.741176, 0.560784, 0.819608, 1.000000);

With ColorPara and instance qualifier: instance uniform vec4 ColorParameter : source_color = vec4(0.741176, 0.560784, 0.819608, 1.000000);

With ColorPara and none qualifier: uniform vec4 ColorParameter : source_color = vec4(0.741176, 0.560784, 0.819608, 1.000000);

jsjtxietian commented 11 months ago

Looks like the instance ColorPara is appearing differently from colorConstant and none ColorPara one. I hijacked the colorConst node, force it to do a linear2srgb conversion and it looks like instance ColorPara now. But the ColorPara with none qualifier still seem not have the conversion.