Preparing Unity Render Settings

Проверено с версией:: 2017.3


Сложность: Средняя

The following advice focuses on achieving a believable visual target. Understanding how Unity’s rendering features can be used to realistically mimic the real world will enable you to quickly achieve your project’s believable visual goal. For greater depth information, visit Unity lighting and rendering tutorial.

Linear rendering mode

In simple terms, this sets Unity to do lighting and shading calculations using physically accurate math before transforming the final output into the format that works best for monitors.

To specify a gamma or linear workflow, go to Edit > Project Settings > Player and open Player Settings. Then go to Other Settings > Rendering and change the Color Space to Linear.

Defining your color space should be one of the earliest decisions in your project because of the drastic impact on the final shading and lighting results. Unity has good documentation explaining each workflow.

Rendering mode

In the Spotlight Tunnel Sample Scene, Deferred rendering mode is used. This allows content creators to work with multiple dynamic lights efficiently, combined multiple reflection cubemap and be able to use the existing Screen Space Reflection features in Unity 2017+.

Set this in Graphic Settings > Rendering Path or set in Camera > Rendering Path

For more in depth rendering mode information refer to the Unity documentation.

High Dynamic Range (HDR) Camera

When rendering believable lighting, much like real life, content creators will be dealing with lighting values and emissive surfaces that have a brightness higher than 1 (high dynamic range). These values then need to be remapped to the proper screen range (tonemapping). This setting is crucial to allow the Unity camera to process these high values and not clip it. To enable this, select the main camera on the scene. Ensure that HDR is checked in the inspector tab for the selected camera.

HDR Lightmap encoding (optional)

The "Spotlight Tunnel" Sample Scene didn’t use baked lighting, however if you are planning to work with High intensity (HDR) baked lighting, setting the lightmap encoding to HDR lightmap is recommended to make sure the baked light result is consistent. The option can be found under Edit > Project > Player settings > Other settings > Lightmap encoding (Unity 2017.3+ only). Detailed information for Lightmap encoding can be found here.

Tonemapper for your Scene

To display HDR lighting properly, tonemapper need to be enabled in the project. Make sure Unity Post Process asset are installed in your project.

Setup in Post Process stack V1: (the version used in the “Spotlight Tunnel” scene.)

  • Create a Post Process Profile Asset in your project and configure it as such:

    • Enable Color Grading > Tonemapper > ACES (Academy Color Encoding Standards)
    • Enable Dithering Dithering allows the Scene to alleviate banding artifact introduced by 8 Bit/channel output from HDR Scene. Modern engines use this technique to circumvent the limitation of 16M colour output.
    • Leave the rest of settings in tonemapper alone for now.
  • Select the “Main Camera” and Add component, Post Processing Behaviour.

  • Assigned the Post Process profile previously created to the profile slot. For Post Process stack V2, please refer to the readme of the package as it is currently in Beta development phase.

Enable Image effect for viewport

This enables user to see the tonemapper all the time while working with the Scene view.

^Notice the highlight rendition and the dark tunnel value separation improvements in the tonemapped Scene. If you look at the non-tonemapped Scene, you can see how the highlights didn’t converge to a unified color. (the yellowish burning sun in this case).

This setup essentially try to replicate how a Digital camera captures a Scene with a fixed exposure (without exposure adaptation / eye adaptation features enabled).

At this point, content creators have achieved proper foundational scene rendering setup that should give believable results with a wide range of content.