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

Expand adjustments into more proper color grading #6613

Open
ettiSurreal opened this issue Apr 2, 2023 · 2 comments
Open

Expand adjustments into more proper color grading #6613

ettiSurreal opened this issue Apr 2, 2023 · 2 comments

Comments

@ettiSurreal
Copy link

ettiSurreal commented Apr 2, 2023

Describe the project you are working on

Applies to most projects i work on.

Describe the problem or limitation you are having in your project

Currently, adjustments in WorldEnvironment are very lacking compared to most other applications and game engines.

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

A more feature packed color grading solution. Ideally it should let you individually grade colors at Shadows, Midtones and Highlights, as well as let you adjust HSV and Contrast for individual colors.

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

Here is a mock up I made, mainly based on Unreal Engine, with some hints from Unity and Blender.
NOTE: It is only a UI mock up, none of this is actually implemented.

image
I have decided to make them into resources for easier reuse, and because of the sheer amount of settings. Though i can see Color Grade being possible to integrate into the Environment resource, with an enum to switch between the Simple and Advanced modes.
For performance concerns, there will be two versions of the Color Grade resource, Simple and Advanced, the former only having Global adjustments

Here is a simple explanation of what each of the settings does

  • Look Up Table - formerly Color Correction,
  • LUT Contribution - the strength of Look Up Table, saw that both Unity and Unreal have that, so i decided to include it.
  • Temperature - Makes the scene cooler or warmer.
  • Tint - Tints the scene to Cyan or Magenta to balance out the temperature.
  • Midtones Start and End - Adjusts the threshold of when the midtones start and end.

image
This is how the resource for Global, Shadows, Midtones and Highlights looks like.

Lift, Gamma, Gain and Offset allow for changing the intensity and tinting of the tones.
Lift affects the low tones
Gamma affects the mid tones
Gain affects the high tones
Offset affects the entire tonal range

Hue, Saturation, Value and Contrast would use a specialized curve resource that allows adjustment of each under a specific hue.
image
Blender's Hue Correct node is a good example of how it would look like. Ideally, the first and last point would be clamped to the edges and have the same Y value.
Additionally each of these parameters would have a Multiplier, which mainly exists for convenience of not having to use a curve to quickly adjust either of the values.
Brightness is renamed to Value as AFAIK it is more well known with the context of Hue and Saturation (HSV).

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

I imagine this could be implemented through a custom shader and a few resources, but it seems like a large project to do.

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

Bringing the engine more in line with other software.

@Calinou
Copy link
Member

Calinou commented Apr 3, 2023

The issue with implementing a lot of adjustments is that they can end up taking a siginificant amount of GPU time on low-end systems (integrated graphics and mobile). This is not a problem if you make the adjustments create a LUT and sample only that texture at runtime, but it prevents adjustments from being… adjusted during gameplay as (re)creating the LUT takes a while. Supporting both baked and real-time approaches would require a lot of code for a feature that wouldn't be used very often to its full extent.

If you rely on color correction a lot, it's also worth creating your own 3D LUT in an image editor using the workflow described in the documentation.

Remember that color correction isn't always something you can make optional in your game, since it can be the defining factor of your game's art direction. Therefore, it needs to be as cheap as possible.

@ettiSurreal
Copy link
Author

The issue with implementing a lot of adjustments is that they can end up taking a siginificant amount of GPU time on low-end systems (integrated graphics and mobile).

That's why I suggested Simple and Advanced ColorGrade resources, former omitting Shadow, Highlight and Midtone adjustments. Could maybe go further and make the ColorAdjusment resource also have two versions, the simpler one only having linear parameters and a simple full image tint probably.

I am not sure how possible the modularity of this is, and if it'd even solve the performance concerns but if it does, it seems like the best way to go to avoid code repetition

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

2 participants