Color Grading

Overview

Color correction is a post processing effect that takes a frame rendered by the Engine and changes the appearance of colors in various ways.

These typically include effects like Hue & Saturation, Contrast & Brightness, Luminance & Color Curves, Sepia, etc.

Creating Color Charts from Reference Images

Color correction by example takes a reference image that gets color corrected by an artist. The image includes a color chart so all transformation steps applied to the image can later be reconstructed by the engine in real-time.

Take an arbitrary reference image that hasn't been color corrected yet and (ideally) shows a wide range of colors. It should have reasonable size.

Avoid using insanely high resolution images as they won't improve color correction quality and only waste space and processing time in the resource compiler.

Copy/paste the attached RGBChart.bmp into the reference image. It is important to use the color chart supplied with this document, as otherwise the resource compiler later on won't be able to detect and extract the chart.

Flatten all layers, and save the file.

Color correct the reference image. While doing so always pay attention to how the colors inside the chart react.

Avoid extreme levels of saturation (usually a result of color correcting desaturated images) or abrupt changes between similar colors as otherwise these will result in banding artifacts when later applying the chart during post processing inside the engine.

It is also recommended to use reference images that initially show a wide range of colors.

Save the reference image as a CryTIF file using the following naming convention: filename + _cch.tif. For example: sample_cch.tif

If you follow this naming convention the resource compiler should automatically pick "ColorChart" as the preset to be used. If for any reason this preset was not chosen, please do so manually.

Make sure that the image is not tiled in the Resource Compiler. Then click Generate Output in order to create a file with a .dds extension. Please be aware that the name of the file may change.

Integrating Color Charts

The .dds color chart must now be copied to the textures.pak file. Before copying the file, the Sandbox Editor must be closed, as this is a compressed folder. You will need to create a new folder inside of the texture pack called colorcharts.

Your sample color chart in its correct location should look like this: Textures.pak\Textures\colorcharts\sample_cch.dds

Enabling Color Charts in Sandbox

In order to enable color charts in Sandbox, there are several console variables that you need to enable.

First, set r_ColorGrading to 2.

r_ColorGrading 1 is legacy, and will be removed in a future version of the engine; although, it may be necessary to use r_ColorGrading 1 for early versions of CryENGINE 3.

r_ColorGrading

Enables color grading.
Usage: r_ColorGrading [0/1]

Then, set set r_ColorGradingCharts to 1 or 2. Setting 2 functions the same as 1, but shows a display in the upper left corner of the perspective view with the color chart, blending information and name of any static color charts that are loaded.

By default r_ColorGradingCharts enables dynamic blending of color charts which requires game code or flow graph communication. For more information on setting up color correction in the Flow Graph, please see Image Nodes.

r_ColorGradingCharts

Enables color grading via color charts.
Usage: r_ColorGradingCharts [0/1]

Finally, in order to load and use a static color chart that overwrites the dynamic blending results mentioned above, use the console command r_ColorGradingChartImage and specify the path to the color corrected reference image.

Example: r_ColorGradingChartImage textures/colorcharts/sample.dds

r_ColorGradingChartImage

If called with a parameter it loads a color chart image. This image will overwrite
 the dynamic color chart blending result and be used during post processing instead.
If called with no parameter it displays the name of the previously loaded chart.
To reset a previously loaded chart call r_ColorGradingChartImage 0.
Usage: r_ColorGradingChartImage [path of color chart image/reset]

In order to switch back to dynamically blended charts use r_ColorGradingChartImage 0.

Color charts can be visualized / debugged via r_ColorGradingCharts 2. This displays the name, texture content and blend amount of every chart currently set for blending as well as the final blending result that is used in the post processing step.

In case you switch to a static color chart as mentioned previously it'll be displayed accordingly.

Results

Before/After shots of sample_cch.dds applied to the Crysis game level, "Village"

Troubleshooting

If you encounter visual glitches on the PC, please ensure that you haven't overwritten 3D settings for either the editor or game launcher in the control panel of your video driver. This is a major source of visual artifacts.

Especially enforcing multi-sampling or anisotropic texture filtering can break post processing effects, deferred shading, and other things. Ideally, in such case a message box would be shown to alert the user.

However, there's currently no way to detect that the video driver is overwriting settings the application assumes to be in control of.


Resetting 3D settings in the video driver's control panel.