Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
VoxelGI.hpp File Reference

Diffuse global illumination from a world-space voxel cache, run as compute passes (WebGPU). More...

#include "../../core/Types.hpp"
#include "../graph/RenderGraph.hpp"
#include "../rhi/GfxEnums.hpp"
#include <glm/glm.hpp>
#include <string>
#include <unordered_map>
Include dependency graph for VoxelGI.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esengine::VoxelGIParams
class  esengine::VoxelGI

Namespaces

namespace  esengine

Detailed Description

Diffuse global illumination from a world-space voxel cache, run as compute passes (WebGPU).

What a frame can see of the scene, remembered in the world. A grid of voxels follows the camera (addressed toroidally, so it does not move with it): every frame the lit picture is injected into the voxels its visible surfaces stand in — their average radiance and the way they face — and what was there before fades. Light then is gathered the way a path tracer would, but through the grid: from each visible surface a few cosine-weighted rays are marched cell by cell (a DDA walk), and where one meets a voxel that faces it, that voxel's radiance is the light it brings. Because the grid keeps what it has seen, a red wall that has left the screen still tints the floor beside it, and a surface lit only by another is lit — which a screen-space pass cannot do.

It is not a trace of the scene's geometry: the grid holds the surfaces the camera has seen, at the voxel's size, so a surface it has not seen sends no light and a thin one is as thick as a cell. That is the price of needing no mesh voxelization, and the reason the result is called what it is.

Four compute passes per frame, declared into the frame's render graph: maintain (age the grid, hand cells that moved into the window back as empty), inject (the picture into the grid), gather (rays through the grid, at a fraction of the picture's size) and apply (the gathered light over the picture, upsampled with the depth). Needs a device with a compute stage; elsewhere the pass is left out of the chain.

Definition in file VoxelGI.hpp.