Unity URP Volumetric Light

repository·main·Indexed 21 days ago

https://github.com/cristianqiu/unity-urp-volumetric-light

A volumetric fog solution for Unity's Universal Render Pipeline (URP) that integrates with the URP volume system. Supports main, spot, and point lights, including shadows and cookies. Compatible with Unity 2022.3 LTS through Unity 6000.5, supporting Forward, Deferred, Forward+, and Deferred+ rendering paths. Render graph support is available for Unity 6 and above.

Tokens
523
Snippets
1
Records
4
Agent score
25%

What's inside unity-urp-volumetric-light

  1. Requirements and Compatibility

    main

    Unity Versions

    • Unity 2022.3 LTS (included) up to Unity 6000.5.

    Rendering Paths & Features

    • Supported Paths: Forward, Deferred, Forward+, and Deferred+.
    • VR Support: Single pass VR rendering is supported (Multipass VR is not supported).
    • APV Support: Supported for Unity 2023.1+.
    • Graphics APIs: Verified in DirectX11, DirectX12, OpenGLES3, OpenGLCore, and Vulkan.

    Unsupported Platforms/Features

    • WebGL: Not supported.
    • Consoles: Not tested on Switch 1/2 or PS4 (Verified on Steam Deck, Xbox One/XSX, and PS5).
  2. Install Unity-URP-Volumetric-Light via UPM

    main

    The recommended installation method is using the Unity Package Manager (UPM). Ensure that the Universal Render Pipeline (URP) is already installed and correctly configured in your project before proceeding.

    1. Open the Package Manager in Unity via Window -> Package Manager.
    2. Click the + icon in the top-left corner and select Add package from git URL....
    3. Enter the following URL and click Install: https://github.com/CristianQiu/Unity-URP-Volumetric-Light.git
    https://github.com/CristianQiu/Unity-URP-Volumetric-Light.git
  3. How to add volumetric fog to a scene

    main

    Follow these steps to integrate volumetric fog into your URP project:

    1. Renderer Setup: Add the volumetric fog renderer feature to your URP Renderer asset.
    2. Post-Processing: Enable post-processing on both your Camera and your URP Renderer.
    3. Volume Configuration:
      • Add a Volume to your scene.
      • Add the override: Custom -> Volumetric Fog.
      • Check the Enabled checkbox (it is disabled by default).
      • Enable Enable Main Light Contribution and Enable Additional Lights Contribution as needed.
    4. Light Contribution: For spot lights and point lights to contribute to the fog, add the VolumetricAdditionalLight component to those specific lights.

    Note: If fog is not visible, try increasing light intensity or adjusting the volume parameters.