Version: 2017.4
Reflection probe performance and optimisation
HDR color picker

Визуализация HDR (расширенный динамический диапазон) в Unity

При стандартной визуализации, красная, зеленая и синяя компоненты пикселя представлены дробным числом в диапазоне 0..1, где 0 указывает на нулевую интенсивность, а единица представляет максимальную интенсивность на дисплее. Хотя это просто в использовании, оно не отражает того, как освещение работает в сцене из реальной жизни. Человеческий глаз, как правило, приспосабливается к условиям освещения, так что объект, который выглядит белым в тускло освещенной комнате, в действительности может быть менее ярким, чем серый объект при дневном освещении. Кроме того, глаз более чувствителен к различиям яркости на нижнем краю диапазона, чем на верхнем.

More convincing visual effects can be achieved if the rendering is adapted to let the ranges of pixel values more accurately reflect the light levels that would be present in a real scene. Although these values will ultimately need to be mapped back to the range available on the display device, any intermediate calculations (such as Unity’s image effects) will give more authentic results. Allowing the internal representation of the graphics to use values outside the 0..1 range is the essence of High Dynamic Range (HDR) rendering.

Работа с HDR

HDR включается для каждой камеры отдельно при при помощи свойств компонента Camera:-

When HDR is active, the scene is rendered into an HDR image buffer which can accommodate pixel values outside the 0..1 range. This buffer is then used by post-processing effects such as the Bloom effect in the Post-processing stack. The HDR image is then converted into the standard low dynamic range (LDR) image to be sent for display. This is usually done via Tonemapping, part of the Color Grading pipeline. The conversion to LDR must be applied at some point in the post-process pipeline but it need not be the final step if LDR-only post-processing effects are to be applied afterwards. For convenience, some post-processing effects can automatically convert to LDR after applying an HDR effect (see Scripting below).

Tonemapping (тональная компрессия)

Tonemapping is the process of mapping HDR values back into the LDR range. There are many different techniques, and what is good for one project may not be the best for another. A variety of tonemapping techniques have been included in the Post-processing stack. To use them you can download the Post-processing stack from the Asset Store. A detailed description of the tonemapping types can be found in the Color Grading documentation.

An exceptionally bright scene rendered in HDR. Without tonemapping, most pixels seem out of range.
An exceptionally bright scene rendered in HDR. Without tonemapping, most pixels seem out of range.
The same scene as above. But this time, tonemapping is bringing most intensities into a more plausible range. Note that adaptive tonemapping can even blend between above and this image thus simulating the adaptive nature of capturing media (e.g. eyes, cameras).
The same scene as above. But this time, tonemapping is bringing most intensities into a more plausible range. Note that adaptive tonemapping can even blend between above and this image thus simulating the adaptive nature of capturing media (e.g. eyes, cameras).

Преимущества HDR

  • Цвета в зонах высокой интенсивности не будут потеряны
  • Лучшая поддержка блума и свечения (glow).
  • Снижение banding-артефактов в областях с низкочастотным освещением

Недостатки HDR

  • Используется буферы с плавающей запятой (отрисовка медленней и требуется больше видеопамяти)
  • No hardware anti-aliasing support (but you can use an Anti-Aliasing post-processing effect to smooth out the edges)
  • Поддерживается не на всём оборудовании

Заметки по использованию

Forward Rendering (упреждающий рендеринг)

In forward rendering mode HDR is only supported if you have a post-processing effect present. This is due to performance considerations. If you have no post-processing effect present then no tonemapping will exist and intensity truncation will occur. In this situation the scene will be rendered directly to the backbuffer where HDR is not supported.

Deferred Rendering (отложенный рендеринг)

In HDR mode the lighting buffer is also allocated as a floating point buffer. This reduces banding in the lighting buffer. HDR is supported in deferred rendering even if no post-processing effects are present.

Скриптинг

The ImageEffectTransformsToLDR attribute can be added to a post-processing effect script to indicate that the target buffer should be in LDR instead of HDR. Essentially, this means that a script can automatically convert to LDR after applying its HDR post-processing effect. See Writing Post-processing Effects for more details.

See also

HDR Color Picker.

Reflection probe performance and optimisation
HDR color picker