Skip to content

Depth Coloring - Stylized Fog

The Depth Coloring effect allows you to apply a color gradient based on the distance from the camera, creating atmospheric depth effects, fog variations, and stylized scenes. This effect is extremely useful for establishing mood and improving visual depth perception in your 3D scenes.

The demo's forest with Depth Coloring: the far trees take the gradient's colors while Depth Zone Length changes how quickly they do

To use the Depth Coloring effect, follow these steps.

In the material inspector, on every material that should take the color:

Depth Coloring ticked in the Material Inspector, with its note asking for the DepthColoringCamera component

2. Create a Depth Coloring Properties asset

Section titled “2. Create a Depth Coloring Properties asset”
  • Right-click in the Project window
  • Select Create → AllIn13DShader → Others → Depth Coloring Properties
  • Name your new asset appropriately (e.g., “FoggyMountain” or “StylizedFog”)

3. Add the Depth Coloring Camera Component

Section titled “3. Add the Depth Coloring Camera Component”
  • Select your main Camera in the Hierarchy
  • Add the Depth Coloring Camera component
  • Assign your asset to its Depth Coloring Properties field
The Depth Coloring Camera component on the camera with its asset assigned and the values drawn below it

Edit the values on the camera’s inspector rather than on the asset, because that is what sends them to the shader. Assigning the asset alone doesn’t: disable and enable the component, or change a value there, to apply it.

The alpha of the gradient sets how strongly the color is applied at each depth.