godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Implement further color correction post processing effects #4731

Open jcostello opened 2 years ago

jcostello commented 2 years ago

Describe the project you are working on

3D environment lighting in Godot

Describe the problem or limitation you are having in your project

Working on 3D environments, specially on the lighting I realize that setting the color mood is not that easy in Godot. Currently Godot's color correction post processing effect is not enough and is not easy to set up the right tones.

The only thing to have in mind is that in these before and after, I wouldn't take advantage of the indirect light energy when baking light compared with the other engine bellow

Before

image

After

image

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

It would be ideal to have shadow/midtones/highlights as well as lift/gamma/gain color correction effects to help setting the right color mood in the scene. Also Having an intensity slider to animate them would be ideal.

Color correction done in other engine.

Before image

After image

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

Ideally it would be on the Environment Node

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

Could be a shader but IMO it would be nice to have it on the engine available for everyone as it is something that most of the people would tweak

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

Same as above

Calinou commented 2 years ago

Related to https://github.com/godotengine/godot-proposals/issues/2196.

All the color correction you've mentioned can already be done using a well-crafted 3D LUT texture, but I agree that exposing built-in shadows/midtones/highlights adjustments would be useful, especially when using ACES tonemapping (as it tends to make things dark). However, this needs to be done in a way that doesn't cause a performance penalty when you don't use the feature.

Edit: Standard shadows/midtones/highlights adjustments can be performed using a 1D LUT texture, even.

jcostello commented 2 years ago

@Calinou I agreed. Althought it can be done, it need to be crafted outside and could be a bit tedious. Also I dont know if you can achive the same result when pushing the shadows up or the highlights down.

Either way, as you said, performance should not be affected when this is not used.

VivianVerdant commented 2 years ago

This would be very useful. I use color correction suites in video editing software all the time, and being able to fine tune the way lighting and shadows looks can be powerful in setting the mood and readability in a scene.

fire commented 2 years ago

Feel free to salvage my color management system pr.

https://github.com/fire/godot/tree/littlecms

jcostello commented 2 years ago

Feel free to salvage my color management system pr.

https://github.com/fire/godot/tree/littlecms

I don't have the knowledge to do so. Anyone? :pray:

QbieShay commented 2 years ago

Related to #2196.

All the color correction you've mentioned can already be done using a well-crafted 3D LUT texture, but I agree that exposing built-in shadows/midtones/highlights adjustments would be useful, especially when using ACES tonemapping (as it tends to make things dark). However, this needs to be done in a way that doesn't cause a performance penalty when you don't use the feature.

I think we could use a LUT under the hood and perhaps give a good in-engine tool to generate one?

Calinou commented 2 years ago

I think we could use a LUT under the hood and perhaps give a good in-engine tool to generate one?

LUT generation in the engine is an interesting idea, but it also prevents doing real-time manipulation (as generating a 3D LUT can take a while). I'm not sure how often people would need to change shadows/midtones/highlights during gameplay though.

VivianVerdant commented 2 years ago

Being able to make changes in real time, or blend between custom presets would be useful in instances like traveling between indoors and outdoors, or during day-night cycles.

Calinou commented 2 years ago

Being able to make changes in real time, or blend between custom presets would be useful in instances like traveling between indoors and outdoors, or during day-night cycles.

See also https://github.com/godotengine/godot-proposals/issues/4580. If you can blend between two LUTs, then (almost) anything is possible.

QbieShay commented 2 years ago

Yes I'd lean towards blending multiple LUTs, yes :) although this could be more expensive (computation wise) than just regulating a uniform across all shadow passes? maybe we can expose these parameters in project settings or world environment (shadow tint, light tint, etc.)

Calinou commented 2 years ago

although this could be more expensive (computation wise) than just regulating a uniform across all shadow passes? maybe we can expose these parameters in project settings or world environment (shadow tint, light tint, etc.)

Shadows/Midtones/Highlights adjustments don't actually affect shadow or light appearance. They affect specific levels of the image's brightness by adjusting parts of the luminance curve. It's kind of like using a Curves filter in an image editor.

jcostello commented 2 years ago

although this could be more expensive (computation wise) than just regulating a uniform across all shadow passes? maybe we can expose these parameters in project settings or world environment (shadow tint, light tint, etc.)

Shadows/Midtones/Highlights adjustments don't actually affect shadow or light appearance. They affect specific levels of the image's brightness by adjusting parts of the luminance curve. It's kind of like using a Curves filter in an image editor.

Exactly.

If we can have a LUT generating tool with the same adjustments Im fine with that. I checked on how can you generate LUT textures in something like Gimp and you use GMIC (altering values like the ones we described above) and then generate the texture. So maybe similiar results can be achived inside the engine and generate a LUT texture

QbieShay commented 2 years ago

If the agreed approach is to generate LUTs, then i think we need to re-answer the question "can it be done with an addon"

jcostello commented 2 years ago

Sure It can, but probably tricky done by an addon. In my opinion this could be in the core as an upgrade of the existing post effect

fire commented 2 years ago

The design is that we give icc color profiles or alternative tables to https://github.com/fire/godot/tree/littlecms and it'll generate a lookup table texture by taking a standard color 2d array / texture atlas and multiplying the lut with the texture and then set as the color grade option in godot 4.

ArseniyMirniy commented 1 week ago
  1. Using LUTs doesn't make it easier for casual audience
  2. For now, you can use my Visual Shader for color correction and screen effects: https://github.com/ArseniyMirniy/Godot-4-Free-Color-Correction-and-Screen-Effects-Visual-Shader — it's fairly easy to use and it works well with basic systems (like auto exposure). For 4.3 it's better to use ACES, for 4.4 AgX will probably make more sense.

The shader allows making the image Warmer, Colder, tweak greens, use Vignette, Saturation, and Brightness, etc.