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

Reverting colors in a spatial shader with a custom inspector, reverts the colors incorrectly #45388

Open
Arnklit opened this issue Jan 23, 2021 · 4 comments

Comments

@Arnklit
Copy link
Contributor

Arnklit commented Jan 23, 2021

Godot version:
3.2.3.Stable

OS/device including version:
NA

Issue description:
When implementing a custom inspector by parsing values from a shader and reverting them, the reverted colors end up too bright.
BXQvz0j9aB

Steps to reproduce:
Open up the attached project and open the "spatial_example.tscn" and try setting the colors and reverting them.
Note: This is not an issue when using a canvas_item shader. There is an "canvas_item_example.tscn" included in the project, that is set up the same way but with a canvas_item shader that shows no issue.

Minimal reproduction project:
color_revert.zip

@Chaosus Chaosus added this to the 3.2 milestone Jan 23, 2021
@Arnklit
Copy link
Contributor Author

Arnklit commented Jan 23, 2021

I've been looking for a workaround for this and found another way of showing the issue that might be easier to troubleshoot.

set_shader_param("color_parameter", null)

Will cause the same issue, with "resetting" to this incorrect brighter value.

@Calinou
Copy link
Member

Calinou commented Jan 23, 2021

This is likely to be a sRGB conversion issue, but the issue may be in the renderer instead of the editor inspector.

@Arnklit
Copy link
Contributor Author

Arnklit commented Jan 26, 2021

I've been running into more issues using custom inspectors for materials. I assume it's all connected. For example in this case using a mat4 uniform to tranfer data, the revert is also changing values in unexpected ways inside the shader if you use a custom inspector, but not if you use the ShaderMaterial inspector.

ieLVgVtlVx

The uniform being serialised above just looks like this in the shader:

uniform mat4 colors = mat4(vec4(0.1, 0.4, 0.7, 1.0), vec4(0.2, 0.5, 0.8, 1.1), vec4(0.3, 0.6, 0.9, 1.2), vec4(0.0));

@akien-mga akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
@akien-mga akien-mga modified the milestones: 3.3, 3.5 Oct 25, 2021
@akien-mga
Copy link
Member

CC @godotengine/rendering

@KoBeWi KoBeWi modified the milestones: 3.5, 3.x Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants