Bevy Developer Network
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
1
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Phyisically based unified volumetrics system ## Overview > Tracking issue: https://github.com/bevyengine/bevy/issues/18151 This is a design document for a unified volumetrics system that combines the functionality of `FogVolume`, `Atmosphere`, and other volumetric effects into a cohesive, physically-based system. The system focuses on providing robust defaults for common volumetric effects while maintaining a clean, extensible architecture for more specialized implementations. ## Current State Bevy implements volumetric effects through three systems: 1. `Atmosphere` - Physical scattering using Rayleigh/Mie phase functions, precomputed LUTs for transmittance (2D), multiscattering (2D), and inscattering (3D), with full planetary curvature support 2. `FogVolume` - Localized volumes using bounded meshes, arbitrary 3D density fields, and Henyey-Greenstein phase function for anisotropic scattering 3. `DistanceFog` - Screen-space post-process effect (out of scope for this system) The current `Atmosphere` implementation uses Rayleigh and Mie phase functions for physical scattering. The system pre-computes three distinct lookup textures (LUTs): - a 2D transmittance LUT for accelerating the inner integral term - a 2D multiscattering LUT storing isotropic phase function results under local uniformity assumptions - an optional 3D frustum-fitted LUT for inscattering values It accounts for planetary curvature, height-based density variation, and integrates with the PBR pipeline for accurate light transport and sunlight attenuation. The 3D inscattering LUT approach limits shadow resolution to the view-plane texture resolution. `FogVolume` components define localized volumetric media through bounded meshes with world-space transforms. Unlike the height-based density profile of the atmosphere system, fog volumes support arbitrary 3D density distributions through uniform parameters or 3D textures. The implementation handles volumetric shadows from both directional and point light sources, using the Henyey-Greenstein phase function to model anisotropic light scattering through the medium. The `DistanceFog` component is a basic screen-space effect for distance-based fog. It has an `Atmospheric` mode that mimics the behavior of the atmosphere, but only uses simple exponential math for light extinction and inscattering with a single bounce. The `Atmosphere` and `FogVolume` components are different - they work directly with the PBR lighting pipeline and use proper physics. Since `DistanceFog` is just a post-process effect that doesn't use real physics, it won't be part of the unified volumetrics system. ## Core Features The following section describes the proposed architecture for the unified volumetrics system. It provides essential building blocks for volumetric rendering: 1. Core volumetric rendering pipeline integration 2. PBR-based light transport interfaces 3. Density field manipulation primitives 4. Common presets for basic effects The system ships with robust defaults for: - Global atmospheric scattering - Local volumetric media - Basic density field operations Users can extend the system through compute shaders and the density field API for specialized effects. The clean separation between core rendering and simulation logic ensures consistent visual quality while maintaining flexibility. For example, smoke effects can be implemented using the basic density primitives, while more complex phenomena can leverage the compute shader interface for custom evolution rules. ## Proposed Changes Component names and terminology are the following, specifically focusing on terms like: - "Volumetric": spatial computation rather than opaque objects - "Medium": the material properties of the volumetric effect This is also a proposal to avoid the term "Fog" because that term refers to a particular scattering medium, rather than a generic component that can be used to describe any volumetric effect. Module path in Bevy PBR crate: ``` bevy_pbr/src/volume/mod.rs ``` This proposal combines the `AtmospherePlugin` and `VolumetricFogPlugin` under a single `VolumetricPlugin`, as well as keep some existing components in order to control the volumetric effects. We also combine the `Atmosphere` and `FogVolume` under common interfaces, structs in `bevy_pbr/src/volume/mod.rs`: ```diff - struct VolumetricFogPlugin - struct VolumetricFog - struct Atmosphere - struct AtmosphereSettings struct VolumetricLight + struct VolumetricPlugin + struct VolumetricMedium + struct VolumetricSettings ``` - `VolumetricMedium`: Core component for all volumetric effects - `VolumetricSettings`: Shared rendering configuration Key design principles: - Physical accuracy: proper light transport and multiple scattering - Extensibility: compute shader support for custom implementations - Performance: unified render pass for multiple media - Presets: `VolumetricMedium::EarthAtmosphere`, `VolumetricMedium::Clouds` # Technical Design ## Media Interaction and Light Transport The system handles multiple media through unified ray integration: ```wgsl struct MediaProperties { density: f32, scattering: vec3<f32>, absorption: vec3<f32>, } fn sample_media(ray_pos: vec3<f32>) -> MediaProperties { var result = MediaProperties( 0.0, // density vec3(0.0), // scattering vec3(0.0) // absorption ); for (var i = 0u; i < num_active_media; i++) { let medium = media_buffer[i]; if (intersects_medium(ray_pos, medium.bounds)) { result = combine_media(result, sample_medium(ray_pos, medium)); } } return result; } ``` This eliminates transition artifacts while maintaining physical accuracy through proper extinction and in-scattering combination. ## Performance Optimization Strategy Performance optimization uses a hybrid approach: - Near-field (0-50m): Direct ray-marching, 64-128 steps - Mid-field (50-500m): Frustum-fitted LUT (128³), 32-step ray-march - Far-field (500m+): Pre-computed atmospheric LUT (32² × 8) Acceleration structures: - Deep opacity maps: 256² resolution per light - Hierarchical min/max maps: 4 mip levels for 3D textures - Temporal re-projection: 8-frame history - Adaptive step size: 2x-8x reduction in sample count Culling optimizations: - Frustum culling using volume bounds and density thresholds - Hardware occlusion queries for large opaque volumes - Early-Z culling for volumes behind opaque geometry - Distance-based culling for small volumes beyond mid-field range ## Compute Integration and Physical Accuracy Density field evolution occurs through compute shaders in a dedicated pass, maintaining separation between simulation and rendering concerns. The system requires min/max MIP chains for density textures to support LOD selection and space skipping optimizations. Synchronization barriers ensure stable density sampling across varying update frequencies, while the volumetric medium component handles light transport computation. This architecture allows specialized implementations to balance physical accuracy with artistic control. ## Level of Detail and Scene Scale The froxel-based sampling system adapts to different scene scales through a combination of frustum-fitted LUTs and dynamic LOD transitions. Memory constraints inform LUT configuration choices, with resolution and format selection based on visual importance and distance from viewer. The system preserves detail in near-field volumes while efficiently handling large-scale atmospheric effects through appropriate LOD selection. Using cascading LUTs at different scales could benefit this approach. ## Simulation Parameters The core API focuses on the essential parameters for light transport: density distributions, scattering coefficients, and phase functions. We leave secondary physical properties like temperature gradients to user implementations via compute shaders, since they primarily affect phenomena evolution rather than the rendering process. This keeps the API focused on fundamental volumetric rendering but provides clear paths for extending the system with specialized simulations. ## PBR Integration ```wgsl #define_import_path bevy_pbr::volume // Core light transport computations fn compute_transmittance; fn compute_inscattering; fn compute_multiple_scattering; fn compute_phase_function; // Pre-computed sampling functions fn sample_transmittance; fn sample_inscattering; fn sample_multiple_scattering; // Medium properties sampling fn sample_local_medium; fn sample_density_gradient; fn sample_density_texture; // Screen-space raymarch with built-in jitter/TAA support fn ray_march_volume; ``` **Technical Requirements** **Core Light Transport** - Scattering and absorption coefficients (extinction = scattering + absorption) - Phase functions: Rayleigh, Mie (Cornette-Shanks), Dual lobe Mie - Multiple scattering computation and LUT pre-computation - Self-shadowing via raymarch sampling **Rendering Pipeline** - Volumetric shadow map pass - Volumetric lighting pass - Integration with deferred/forward rendering - HDR and tone mapping support - Shadow map integration for directional/point lights **Performance Optimizations** - 3D density texture storage and sampling - Pre-computed transmittance and in-scattering LUTs - Froxel-based volume sampling - Temporal re-projection (TAA) - Adaptive ray-marching with jittered sampling - Level of detail (LOD) for distant volumes # Appendix ## Mathematical Theory | Symbol | Description | | :--- | :--- | | $\mathbf{x}$ | Position | | $t$ | Ray parameter | | $\omega$ | Ray direction | | $\mathbf{x}_{t}$ | Parameterized position along a ray: $\mathbf{x}_{t}=\mathbf{x}+t \omega$ | | $\sigma_{a}(\mathbf{x})$ | Absorption coefficient | | $\sigma_{s}(\mathbf{x})$ | Scattering coefficient | | $\sigma_{t}(\mathbf{x})$ | Extinction coefficient: $=\sigma_{a}(\mathbf{x})+\sigma_{s}(\mathbf{x})$ | | $\alpha(\mathbf{x})$ | Single scattering albedo: $=\sigma_{s}(\mathbf{x}) / \sigma_{t}(\mathbf{x})$ | | $f_{p}\left(\mathbf{x}, \omega, \omega^{\prime}\right)$ | Phase function | | $d$ | Ray length/domain of volume integration: $0<t<d$ | | $\xi, \zeta$ | Random numbers | | $L(\mathbf{x}, \omega)$ | Radiance at $\mathbf{x}$ in direction $\omega$ | | $L_{d}\left(\mathbf{x}_{d}, \omega\right)$ | Incident boundary radiance at end of ray | | $L_{e}(\mathbf{x}, \omega)$ | Emitted radiance | | $L_{s}(\mathbf{x}, \omega)$ | In-scattered radiance at $\mathbf{x}$ from direction $\omega$ | Transmittance $$ T(t)=\exp \left(-\int_{s=0}^{t} \sigma_{t}\left(\mathbf{x}_{s}\right) d s\right) $$ Volume Rendering Equation (VRE) $$ L(\mathbf{x}, \omega) = \int_{t=0}^{d} T(t) \left[ \begin{matrix} \sigma_{a}\left(\mathbf{x}_{t}\right) L_{e}\left(\mathbf{x}_{t}, \omega\right) + \\ \sigma_{s}\left(\mathbf{x}_{t}\right) L_{s}\left(\mathbf{x}_{t}, \omega\right) + \\ L_{d}\left(\mathbf{x}_{d}, \omega\right) \end{matrix} \right] dt $$ ## Research Material Relevant research material, primarily focus on real-time rendering applications: - Sebastian Hillaire's [publications](https://sebh.github.io/publications/) - Andrew Schneider's [publications](https://www.schneidervfx.com/) - 2020 EGSR paper by Sebatian Hillaire [A Scalable and Production Ready Sky and Atmosphere Rendering Technique](https://sebh.github.io/publications/egsr2020.pdf) - SIGGRAPH 2020 talk by Sebastian Hillarie [Physically Based and Scalable Atmospheres in Unreal Engine](https://www.youtube.com/watch?v=SW30QX1wxTY) - 2018 Eurographics Talk by Andrew Schneider [Nubis Realtime Volumetric Cloudscapes In A Nutshell](https://www.youtube.com/watch?v=-d8qT5-1LOI) - [FMX2017 Technical Directing Special: Real-time Volumetric Cloud Rendering](https://www.youtube.com/watch?v=8OrvIQUFptA) - SIGGRAPH 2015 talk on [Physically Based and Unified Volumetric Rendering in Frostbite](https://www.youtube.com/watch?v=ddfEnuXZijM) - [The Real-Time Volumetric Cloudscapes of Horizon Zero Dawn](https://www.guerrilla-games.com/read/the-real-time-volumetric-cloudscapes-of-horizon-zero-dawn) - Scratchapixel article on [Volume Rendering](https://www.scratchapixel.com/lessons/3d-basic-rendering/volume-rendering-for-developers/intro-volume-rendering.html) Related but not directly relevant: - 2017 Siggraph Course by authors from Pixar, Sony and Disney on [Production Volume Rendering](https://graphics.pixar.com/library/ProductionVolumeRendering/paper.pdf)

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully