Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source_color not working properly #101605

Closed
huwpascoe opened this issue Jan 15, 2025 · 1 comment · Fixed by #101642
Closed

source_color not working properly #101605

huwpascoe opened this issue Jan 15, 2025 · 1 comment · Fixed by #101642

Comments

@huwpascoe
Copy link
Contributor

Tested versions

tested in 4.3 and 4.4 dev builds

System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 960 (NVIDIA; 32.0.15.6636) - Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz (4 Threads)

Issue description

Instantiating a new ShaderMaterial results in the default uniform values marked source_color to skip the sRGB-to-linear transform.

  • If the same scene is saved and reloaded, the correct color is rendered.
  • If the uniform parameter is set in the inspector or by set_shader_parameter(), the correct color is rendered.

Workaround: manually set the uniform to it's own default after instantiating.

material.set_shader_parameter(p_name, RenderingServer.shader_get_parameter_default(material.shader.get_rid(), p_name))

Steps to reproduce

  • Create a MeshInstance3D of a plane
  • Assign a new ShaderMaterial
  • Assign a shader that displays a uniform vec3 of source_color
shader_type spatial;
render_mode unshaded;

uniform vec3 test_color: source_color = vec3(0.2, 0.5, 0.2);

void fragment() {
	ALBEDO = test_color;
}

Note that the color looks washed out.
Save the scene and reload, it now looks correct.

Minimal reproduction project (MRP)

Image
source_color_bug.tscn.zip

@huwpascoe
Copy link
Contributor Author

#70927 maybe related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants