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

Allow picking similar colours using OKHSL. #59786

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

fire
Copy link
Member

@fire fire commented Apr 1, 2022

Fixes: godotengine/godot-proposals#4325

Pain points requested for help:

  • get_ok_hsl_h naming in Color
  • Default pickers
  • How to cite code? for shaders
  • NOT Adding it to the Gradient
2022-04-01.05-11-46.mp4

HSL Game Project.zip test project.

@fire fire requested review from a team as code owners April 1, 2022 12:17
@fire
Copy link
Member Author

fire commented Apr 1, 2022

@gongpha Touched the picker color interface and @clayjohn can be good to review shaders.

Can you check?

@YeldhamDev
Copy link
Member

I wonder if it wouldn't be better if an OptionButton was used instead of two CheckButtons.

@KoBeWi
Copy link
Member

KoBeWi commented Apr 1, 2022

I wonder if it wouldn't be better if an OptionButton was used instead of two CheckButtons.

I was planning to refactor the ColorPicker, because the color modes are awfully hard-coded right now; I might do it eventually™. Somewhat related issue: #31679

@fire
Copy link
Member Author

fire commented Apr 1, 2022

@YeldhamDev if you can send a commit, I can integrate it.

@clayjohn
Copy link
Member

clayjohn commented Apr 1, 2022

I think if we add OKHSL to the colour picker, we should also be adding it to the GradientTexture2D. To me, the real benefit of OKLab is interpolating colours in perceptually uniform space. I think users will be disappointed if they are selecting colours in OKLab, but the colours are interpolated in RGB or HSL.

@fire-forge
Copy link
Contributor

I think if we add OKHSL to the colour picker, we should also be adding it to the GradientTexture2D.

Or it could be added to Gradient, so that everywhere that Gradients are used benefits from it (GradientTexture2D/1D, particles, FastNoiseLite, etc.)

@clayjohn
Copy link
Member

clayjohn commented Apr 1, 2022

I think if we add OKHSL to the colour picker, we should also be adding it to the GradientTexture2D.

Or it could be added to Gradient, so that everywhere that Gradients are used benefits from it (GradientTexture2D/1D, particles, FastNoiseLite, etc.)

Yes, that makes much more sense.

@Calinou Calinou modified the milestones: 3.5, 4.0 Apr 1, 2022
editor/editor_node.cpp Outdated Show resolved Hide resolved
@fire fire force-pushed the ok_color branch 2 times, most recently from 598a54c to f55a4a0 Compare April 3, 2022 10:03
@fire
Copy link
Member Author

fire commented Apr 3, 2022

@clayjohn @fire-forge

Or it could be added to Gradient, so that everywhere that Gradients are used benefits from it (GradientTexture2D/1D, particles, FastNoiseLite, etc.)

Can you guys assist adding to a Gradient after the pr is merged?

@fire fire requested a review from Calinou April 3, 2022 10:30
@clayjohn
Copy link
Member

clayjohn commented Apr 4, 2022

If we are adding OKLab, I think it should be added to gradient at the same time it is added to the color picker. I don't see the value in just exposing it to the color picker. But, of course, let me know if I am wrong.

@fire fire force-pushed the ok_color branch 2 times, most recently from c917e10 to 72b529e Compare April 4, 2022 04:01
@fire-forge
Copy link
Contributor

fire-forge commented Apr 4, 2022

@fire The Gradient changes look good, I haven't tested them yet but I will soon. Also, I noticed that the OKHSL-related Color functions don't seem to be exposed, so maybe you could do that? It could be useful to have access to them in GDScript.

@fire fire force-pushed the ok_color branch 3 times, most recently from 3174cb9 to 6ebef66 Compare April 4, 2022 07:33
@fire
Copy link
Member Author

fire commented Apr 4, 2022

@clayjohn I don't think it's really possible to interpolate all three variables: the hue, the lightness and the saturation. We have to keep one constant and a small change in hues is a big change in HSL space. Interpolating in RGB and then using okhsl lightness and okhsl saturation didn't give good results.

https://stackoverflow.com/a/7391704/381724

@fire
Copy link
Member Author

fire commented Apr 18, 2022

I'll merge the kobewi change properly.

COPYRIGHT.txt Outdated Show resolved Hide resolved
thirdparty/README.md Outdated Show resolved Hide resolved
thirdparty/README.md Outdated Show resolved Hide resolved
@KoBeWi
Copy link
Member

KoBeWi commented May 19, 2022

btw you have me added as a co-author of the commit (probably from applying suggestion on GitHub).

@fire fire force-pushed the ok_color branch 8 times, most recently from 4cef4fd to 1dfa119 Compare May 19, 2022 15:40
core/math/color.cpp Outdated Show resolved Hide resolved
core/math/color.h Outdated Show resolved Hide resolved
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall. Would be nice if @Vitika9 could review too as that will impact her GSoC project.

@VitikaSoni
Copy link
Contributor

VitikaSoni commented Jun 7, 2022

Looks good to me overall. Would be nice if @Vitika9 could review too as that will impact her GSoC project.

Looks good from my project's point of view too :)

@akien-mga akien-mga merged commit d52a79a into godotengine:master Jun 7, 2022
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Add a perceptual color space for color picking
8 participants