# cristianqiu/unity-urp-volumetric-light architecture

> Architecture diagram of the GitHub repository cristianqiu/unity-urp-volumetric-light, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cristianqiu/unity-urp-volumetric-light
- Repository: https://github.com/cristianqiu/unity-urp-volumetric-light

## Overview

This Unity URP package renders configurable volumetric fog as a renderer feature and volume effect. The main workflow is: configure a scene volume and lights, let the renderer feature validate and enqueue its pass for eligible cameras, then render fog using camera depth and lighting before blur and composition. The render pass excerpt confirms depth downsampling, fog rendering, and blur; the README documents broader lighting, shadow, cookie, APV, projection, and render-mode support. Some shader and light-data wiring is not visible in the excerpts, so those links are limited to documented behavior.

Main entry points: [`Runtime/VolumetricFogRenderPass.cs`](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogRenderPass.cs) (Fog render pass), [`Shaders/VolumetricFog.shader`](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricFog.shader) (Fog shading), [`Runtime/VolumetricFogRendererFeature.cs`](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogRendererFeature.cs) (Renderer feature), [`Runtime/VolumetricFogVolumeComponent.cs`](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogVolumeComponent.cs) (Fog volume settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Scene setup"]
  node_volume["Fog volume settings"]
  node_light_component["Additional light settings"]
end

subgraph group_control["URP integration"]
  node_feature["Renderer feature"]
end

subgraph group_render["Fog rendering"]
  node_pass["Fog render pass"]
end

subgraph group_shading["Shader stages"]
  node_depth["Depth downsample"]
  node_fog_shader["Fog shading"]
  node_fog_functions["Fog lighting functions<br/>[VolumetricFog.hlsl]"]
  node_blur["Depth-aware blur"]
  node_upsample["Upsample composition"]
  node_shadows["Volumetric shadows"]
  node_depth_utils["Depth and projection utilities"]
end

node_author(("Scene author"))
node_urp["URP renderer"]
node_camera["Camera inputs"]
node_lights["Scene lights"]
node_fog_result["Camera fog result"]

node_author -->|"configures"| node_volume
node_author -->|"adds to lights"| node_light_component
node_author -->|"adds to renderer"| node_feature
node_urp -->|"requests passes"| node_feature
node_feature -->|"checks active settings"| node_volume
node_feature -->|"enqueues"| node_pass
node_pass -->|"reads depth and camera data"| node_camera
node_pass -->|"reads visible lighting"| node_lights
node_pass -->|"reads fog parameters"| node_volume
node_lights -.->|"uses per-light settings"| node_light_component
node_pass -->|"runs depth downsample"| node_depth
node_pass -->|"runs fog passes"| node_fog_shader
node_fog_shader -->|"uses lighting functions"| node_fog_functions
node_fog_shader -.->|"supports shadowing"| node_shadows
node_fog_shader -.->|"uses projection helpers"| node_depth_utils
node_pass -->|"blurs fog texture"| node_blur
node_pass -->|"composes at camera resolution"| node_upsample
node_upsample -->|"writes fog composition"| node_fog_result

click node_volume "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogVolumeComponent.cs"
click node_light_component "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricAdditionalLight.cs"
click node_feature "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogRendererFeature.cs"
click node_pass "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogRenderPass.cs"
click node_depth "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/DownsampleDepth.shader"
click node_fog_shader "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricFog.shader"
click node_fog_functions "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricFog.hlsl"
click node_blur "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/DepthAwareGaussianBlur.hlsl"
click node_upsample "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/DepthAwareUpsample.hlsl"
click node_shadows "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricShadows.hlsl"
click node_depth_utils "https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/ProjectionUtils.hlsl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_volume,node_light_component toneBlue
class node_feature toneAmber
class node_pass toneMint
class node_depth,node_fog_shader,node_fog_functions,node_blur,node_upsample,node_shadows,node_depth_utils toneRose
class node_author,node_urp,node_camera,node_lights,node_fog_result toneIndigo
```

## Components

### Scene setup

- [Fog volume settings](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogVolumeComponent.cs): `Runtime/VolumetricFogVolumeComponent.cs`
- [Additional light settings](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricAdditionalLight.cs): `Runtime/VolumetricAdditionalLight.cs`

### URP integration

- [Renderer feature](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogRendererFeature.cs): `Runtime/VolumetricFogRendererFeature.cs`

### Fog rendering

- [Fog render pass](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Runtime/VolumetricFogRenderPass.cs): `Runtime/VolumetricFogRenderPass.cs`

### Shader stages

- [Depth downsample](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/DownsampleDepth.shader): `Shaders/DownsampleDepth.shader`
- [Fog shading](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricFog.shader): `Shaders/VolumetricFog.shader`
- [Fog lighting functions](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricFog.hlsl): `Shaders/VolumetricFog.hlsl`
- [Depth-aware blur](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/DepthAwareGaussianBlur.hlsl): `Shaders/DepthAwareGaussianBlur.hlsl`
- [Upsample composition](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/DepthAwareUpsample.hlsl): `Shaders/DepthAwareUpsample.hlsl`
- [Volumetric shadows](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/VolumetricShadows.hlsl): `Shaders/VolumetricShadows.hlsl`
- [Depth and projection utilities](https://github.com/cristianqiu/unity-urp-volumetric-light/blob/main/Shaders/ProjectionUtils.hlsl): `Shaders/ProjectionUtils.hlsl`

### Other components

- **Scene author**
- **URP renderer**
- **Camera inputs**
- **Scene lights**
- **Camera fog result**

## Connections

- Scene author → Fog volume settings: configures
- Scene author → Additional light settings: adds to lights
- Scene author → Renderer feature: adds to renderer
- URP renderer → Renderer feature: requests passes
- Renderer feature → Fog volume settings: checks active settings
- Renderer feature → Fog render pass: enqueues
- Fog render pass → Camera inputs: reads depth and camera data
- Fog render pass → Scene lights: reads visible lighting
- Fog render pass → Fog volume settings: reads fog parameters
- Scene lights → Additional light settings: uses per-light settings
- Fog render pass → Depth downsample: runs depth downsample
- Fog render pass → Fog shading: runs fog passes
- Fog shading → Fog lighting functions: uses lighting functions
- Fog shading → Volumetric shadows: supports shadowing
- Fog shading → Depth and projection utilities: uses projection helpers
- Fog render pass → Depth-aware blur: blurs fog texture
- Fog render pass → Upsample composition: composes at camera resolution
- Upsample composition → Camera fog result: writes fog composition
