UPDATE: Now it includes a version of the shader for the Standard Builtin Pipeline + an example on how to implement it on a custom surface shader.
If you want to use with the builtin pipeline, just delete the URP folder to avoid compilation errors and use the “Tonemapped Standard” shader instead of the “Standard” shader.
This shader is a simple modification of the Universal Render Pipeline Lit shader to allow for tonemapping and color correction without having to use any postprocessing effect and without using HDR buffers.
All color corrections are applied inside the shader, so you don’t even need to use HDR in the camera to have nice color corrected tonemapped images. (although the shader is compatible with HDR in case you want to use postprocesses like Bloom or Glow)
This is specially important for the Oculus Quest, since you can’t do postprocessing effects on it.
Just import the package and replace all “Lit” shaders in your materials with the supplied “Universal Render Pipeline/Tonemapped Lit” and put the included “Tonemapped Lit Controller” prefab in your scene to control the color correction.
DOWNLOAD IT HERE FOR Unity 2019 (only URP)
DOWNLOAD IT HERE FOR Unity 2020.3.2f1 LTS (URP + Built-in Standard)
Color correction adjustments available:
- Color Filter
- Gamma
- Contrast
- Brightness
- Saturation
- Hue Shift (trippy effect)
Of course, you can modify those adjustments in realtime in your game to match the mood of each zone
WARNING! Be sure to disable the color correction before rendering lightmaps!
Otherwise the lightmaps colors will be off!
Limitations: Keep in mind this is only the regular Lit shader. Any other shader like the skybox shader would need to be modified to include the same color corrections. Although you only have to include the “TonemappedLitColorCorrection_Include.hlsl” in the shader an use the function “TonemappedLitColorCorrection(color)” to apply the global color corrections to any custom shader.
Also, since the shadergraph doesn’t expose any way (that I know) to modify the final output color, any custom shadergraph shader will not be compatible with this and just render without color correction.
Take a look at the shader file “LitForwardPass.hlsl” to see how to implement it in other shaders. (from '#include “TonemappedLitColorCorrection_Include.hlsl” ’ to the end)
Some examples:
this is using negative gamma, negative brightness, saturation boost and hue shift to correct the color:
Notice how the hue of the color is the same as the original render but the luminosity has been inverted. That would be cool for a comic book effect.
v1.01: Added Hue Shift and some minor QoL mods.
v1.02: Removed URP dependencies in the shader. This should make it easier to add in non URP specific shaders.