Skip to content

Unity package for versions 2022.3 and Unity 6. Adds support to render volumetric lighting for both the main and additional lights in URP. Compatible with URP render graph in Unity 6.

License

Notifications You must be signed in to change notification settings

CristianQiu/Unity-URP-Volumetric-Light

Repository files navigation

Requirements

Unity 2022.3, 2023.1, 2023.2 or Unity 6.

Features

  • Render graph support for Unity 6.
  • Compatibility mode is also supported.
  • Support for the main light, spot lights and point lights.
  • Shadows and light cookies support for the lights described above.
  • Perspective and orthographic projection support.
  • Single pass VR rendering support. This is verified by users, since I do not work on VR.
  • Seamlessly integrated into URP volume system.
  • Works in forward, deferred, and forward+ rendering paths. See limitations section.
  • Verified in DirectX11, DirectX12, OpenGLES3, OpenGLCore and Vulkan.

Installation

The recommended way to install the package is through the package manager in Unity (UPM).

  1. Inside Unity, go to "Window"-> "Package Manager".
  2. Once the window is opened, go to the "+" symbol at the top left corner, and select "Install package from git URL". See the image below.

Install

  1. Write the following URL: https://github.com/CristianQiu/Unity-URP-Volumetric-Light.git and click install.

How to add volumetric fog

  1. Add volumetric fog renderer feature to you URP Renderer.
  2. Enable post-processing both in your camera and URP Renderer.
  3. Add a volume to your scene and add override: "Custom->Volumetric Fog".
  4. Tick the "Enabled" checkbox, as fog is disabled by default.
  5. Make sure that "Enable Main Light Contribution" and "Enable Additional Lights Contribution" are also enabled depending on your needs, as they are also disabled by default.
  6. For spot and point lights, add the component "VolumetricAdditionalLight" to those lights that you want to contribute to the volumetric fog.
  7. If you still can not see the fog, play with the different volume parameters or try to increase the intensity of your lights.

Known limitations

  • Multipass VR rendering is not supported.
  • WebGL is not supported. See #7.
  • Transparent objects are not blended correctly with fog.
  • Fog is only rendered up to a certain distance from the camera.
  • It may be possible to notice more noise in some light regions at certain view angles.
  • When using forward or deferred rendering path, performance can be heavily affected when adding multiple additional lights. Forward+ is highly recommended for best performance when support for additional lights is needed.

Known Bugs

  • There is an issue with volumetric shadows from lights when "Transparent Receive Shadows" is off in the URP Renderer. If you are having issues with volumetric shadows from lights you may need to turn the setting on. See #10.

TODO

There are a few things that I would like to add at some point, as I like coming back to this project from time to time in my spare time. Some of which are (in no particular order):

  • Deferred+ support for Unity 6.1 when it goes out of beta. I would expect the package to work with it with very minimal changes.
  • WebGL / WebGPU support.
  • Further improvements on performance and quality: quarter resolution rendering, reprojection, better transparency support...
  • New features: density volumes, noise, self shadowing...
  • And of course... bug fixing! Do not hesitate to open issues for anything that you find unexpected or buggy.

Preview

Sponza

Sponza

URP Japanese Garden

Garden

URP Terminal

Terminal

About

Unity package for versions 2022.3 and Unity 6. Adds support to render volumetric lighting for both the main and additional lights in URP. Compatible with URP render graph in Unity 6.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published