Home

Awesome

Z-Based Color Grading and Separate User LUT for Unity's "Post-Processing Stack V2"

Screenshot

Unity's Post-Processing Stack V2 comes with three modes for color grading: LDR, HDR and External LUTs. Unfortunately, HDR mode lacks the option to add a user-defined LUT, and the External LUT mode requires you to color grade in HDR, which Photoshop is not very good at. If you want to grade in Photoshop and use image filters such as curves (or do something funky like posterizing the image), you're left with the LDR color grading mode in Unity, which doesn't apply tonemapping and simply clips color values higher than 1.0

This package works around this limitation by implementing a separate color grading filter, similar to the V1 post-processing stack's "User LUT" effect. Simply add a regular Post-Processing V2 Color Grading effect, set it to HDR and use it to do tonemapping, then add the "User LUT" effect from this package and supply it with an LDR LUT that will be applied after the tone-mapping stage.

The "User LUT" effect in this package also allows you to specify a separate LUT for grading the background (based on the camera's depth texture), so you can apply different color grading for distant objects.

The downside of doing all this in a separate effect is that it comes at a slightly higher cost, since the effect isn't part of the Post-Processing Stack's uber shader, which handles many of Unity's post-processing effects in one pass.

Getting Started

Screenshot

Drop the code from the "UserLUT" folder into your project.

IMPORTANT: For the effect to work in a build, make sure that the supplied UserLUT shader is included in the build.

Add a Post Process Volume and Layer to your camera, if you haven't already. Add a Color Grading effect to the Post Processing Stack, select "High Definition Range" for mode and select the tonemapping of your choice. Leave any other checkboxes/parameters of the Color Grading effect unchecked/default.

Add the effect from this package to the stack ("Custom/UserLUT").

Parameters

Compatibility

Has been tested with Unity 2018.3 and 2019.1 on PC only, but should work on any platform that supports the Post-Processing Stack V2.

Compatible with the Standard rendering pipeline, LWRP and HDRP (HDRP currently only in 2018.3).

Compatible with Gamma and linear lighting.

Orthographic cameras have trouble with the Background Blend Start and Background Blend Range parameters. Z-Blending works in principle, but the units are off and for now you need to experiment to set the right blending distance parameters.

Not tested in VR.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Authors

Philipp Seifried - Much of the code was adapted from the Post-Processing Stack V1 and V2 versions of Color Grading / User LUT.