Version: 2019.1
Related topics
Linear or gamma workflow

Linear rendering overview

The Unity Editor allows you to work in traditional gamma color space as well as linear color space. While gamma color space is the historically standard format, linear color space rendering gives more precise results.

For further reading, see documentation on:

Linear and gamma color space

The human eye doesn’t have a linear response to light intensity. We see some brightnesses of light more easily than others - a gradient that proceeds in a linear fashion from black to white would not look like a linear gradient to our eyes.

Left: A linear gradient. Right: How our eyes perceive that gradient. Note where the borders (which are exactly mid-grey) merge with the gradient in each case
Left: A linear gradient. Right: How our eyes perceive that gradient. Note where the borders (which are exactly mid-grey) merge with the gradient in each case

For historical reasons, monitors and displays have the same characteristic. Sending a monitor a linear signal results in something that looks like the gradient to the right in the illustration above, and simply looks wrong to our eyes. To compensate for this, a corrected signal is sent to make sure the monitor shows an image that looks natural. This correction is known as gamma correction.

The reason both gamma and linear color spaces exist is because lighting calculations should be done in linear space in order to be mathematically correct, but the result should be presented in gamma space to look correct to our eyes.

When calculating lighting on older hardware restricted to 8 bits per channel for the framebuffer format, using a gamma curve provides more precision in the human-perceivable range. More bits are used in the range where the human eye is the most sensitive.

Even though monitors today are digital, they still take a gamma-encoded signal as input. Image files and video files are explicitly encoded to be in gamma space (meaning they carry gamma-encoded values, not linear intensities). This is the standard; everything is in gamma space.

The accepted standard for gamma space is called sRGB (see Wikipedia). This standard defines a mapping to linear space that allows our eyes to make the most of the 8 bits per channel of precision. Below is a diagram of this mapping.

Image courtesy of Wikimedia. License: public domain
Image courtesy of Wikimedia. License: public domain

Linear rendering refers to the process of rendering a Scene with all inputs linear - that is to say, not gamma corrected for viewing with human eyes or for output to a display.

Related topics
Linear or gamma workflow
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961