How to Add Fog in Unity

Introduction
Fog effects play a crucial role in transforming the atmosphere of a Unity scene, adding realism and depth to the gaming environment.
In this comprehensive guide, we will explore various types of fog available in Unity, ranging from the basic Built-In fog to the advanced Volumetric Fog in both URP (Universal Render Pipeline) and HDRP (High-Definition Render Pipeline).
Additionally, we’ll introduce Buto, a powerful and customizable Volumetric Fog asset for game developers.
Unity Rendering Pipelines and Fog Options
Unity offers three rendering pipelines—Built-In, Universal Render Pipeline (URP), and High-Definition Render Pipeline (HDRP)—each influencing the way fog effects are implemented in your scenes.
Built-In Render Pipeline
- Fog Support: Basic fog effects based on camera depth.
- Compatibility: Suitable for projects with modest graphical requirements.
- Performance: Well-performing on lower-end hardware but lacks some advanced graphical features.
Universal Render Pipeline (URP)
- Fog Support:
Compatible with basic fog effects. - Advanced Fog:
URP supports more advanced volumetric fog options like Buto Volumetric Fog and LSPP for enhanced atmosphere. - Compatibility:
Well-suited for mobile devices, VR, and projects with moderate graphical requirements.
High-Definition Render Pipeline (HDRP)
- Fog Support: Includes Unity Volumetric Fog for realistic atmospheric effects.
- Visual Fidelity: Designed for high-end visual quality with advanced rendering features.
- Realism: Ideal for projects targeting high-end platforms with substantial graphical capabilities.
Consider your project’s graphical demands and target platforms when choosing a rendering pipeline.
For basic fog, Built-In and URP are options, but for more advanced and realistic fog effects, HDRP, especially with Unity Volumetric Fog, stands out as the preferred choice.
In URP, Buto Volumetric Fog provides an additional advanced option for developers seeking dynamic and customizable fog effects.
đź“„ Resources:
Understanding Basic Fog in Unity
The fundamental fog effect in Unity is based on camera depth and can be implemented in two forms: exponential or linear. To activate the basic fog:
- Navigate to Window > Rendering > Lightning.
- Click on the Environment tab and go to Other Settings.
- Check the Fog box.
By following these steps, you successfully incorporate basic fog into your game scene. However, note that this type of fog has limitations, especially in the Universal Render Pipeline (URP).
URP (Universal Render Pipeline) and Basic Fog
The basic fog in Unity is supported in URP, which is a lightweight rendering pipeline. While it serves its purpose, we encourage developers to consider more advanced options, such as Volumetric Fog, to enhance the atmospheric effects in their games.
HDRP (High-Definition Render Pipeline) and Unity Volumetric Fog
For a more sophisticated fog effect, HDRP provides the Unity Volumetric Fog. HDRP is a rendering pipeline designed for high-end platforms and high-quality visuals. To enable Unity Volumetric Fog in HDRP:
- Navigate to Graphics in Project Settings.
- Click the Edit drop-down.
- Create a new HDRPAsset by selecting Create > Rendering > High-Definition Render Pipeline Asset.
- Drag and drop the new asset into the Scriptable Render Pipeline field in the Graphics Inspector.
With these settings, you are now ready to add Unity Volumetric Fog to your game project, achieving a more realistic and immersive atmosphere.
Create a free account, or log in.
Gain access to free articles, game development tools, and game assets.