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

VisualShader: Add LinearToSRGB and SRGBToLinear to the ColorFunc node #10818

Closed
tetrapod00 opened this issue Sep 23, 2024 · 0 comments · Fixed by godotengine/godot#97388
Closed
Milestone

Comments

@tetrapod00
Copy link

tetrapod00 commented Sep 23, 2024

Describe the project you are working on

Writing shaders

Describe the problem or limitation you are having in your project

Usually you will never need to convert between linear and SRGB color spaces in user shaders. However, there are a lot of steps along the pipeline and sometimes its useful to use these to check your work. There are also cases where you do want want convert to and from SRGB. Occasionally, SRGB/linear bugs do happen in the actual engine, too, and these nodes can be used to diagnose.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add conversion functions, LinearToSRGB and SRGBToLinear, to the ColorFunc visual shader node.

See also #9150.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Copy the linear/srgb functions used by godot, and add them to the ColorFunc node in visualshader.

If this enhancement will not be used often, can it be worked around with a few lines of script?

You could use an expression node with the conversion function. Or, the simple approximations pow(x, 2.2) and pow(x, .45) do work well enough for simple diagnosis of color space mismatches.

Is there a reason why this should be core and not an add-on in the asset library?

Extends the functionality of an existing node.

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

Successfully merging a pull request may close this issue.

3 participants