A downloadable toy for Windows and Linux

About

This is an experimental project attempting to compute global illumination (aka realistic lighting) in real-time on a small voxel scene. It features a small completely editable voxel scene and computes direct & indirect lighting and soft shadows in real-time.

Some notes

  • Press [ESC] to open settings menu.
  • Press [H] to get in-game help and learn about controls.
  • Currently, only two types of voxels are supported: concrete (diffuse material) and lights (emissive material). You can change their colors however you want, though :)
  • The scene size is currently fixed at 32x32x32 voxels. I'm hoping to remove this restriction in further releases.
  • The light computation algorithm is iterative, so the lighting takes some time to converge. There is a "solver iterations" option in the settings menu which controls this: larger values put more pressure on the GPU (and may lower the FPS), but make the lighting converge faster.
  • Lighting computations are based on randomness (aka Monte-Carlo integration). This might manifest in slight "dirtiness" of the image, which should get cleaner with time.
  • Lighting computations also happen on a voxel grid (see technical details below for the algorithm details), and as such there can (and will) be some artifacts because of that. For example, a shadow less than a voxel in size might not be visible at all.
  • You can save/load created scenes in a custom binary format, as well as export to .obj or .gltf/.glb files.

Technical details

The GI algorithm is surfel-based. For each potentially visible face of each voxel, 4 surfels are spawned at the corners of this face. These surfels store an approximation of the total irradiance received by this point from all directions (the integral from the rendering equation for perfect Lambertian surfaces, excluding the surface albedo). Each frame, a set of random rays (generated using the cosine-weighted hemisphere distribution) are spawned at each surfel; these rays are raymarched through the voxel volume (represented as a 3D texture) to find an intersection. If the ray hits another face, its emitted radiance is computed from the surfel material (diffuse/emitting) and the irradiance bilinearly interpolated from 4 surfels of the intersected face. The results from these intersections are added to the received irradiance of the current voxel with a step size computed from an somewhat hacky ad-hoc variance-guided method.

Then, for each group of surfels that are bound to the same vertex of the voxel grid and share the same normal, their irradiance values are averaged out. This removes discontinuities on voxel edges, and makes large flat surfaces look better.

Rendering to the scene is done with a single simple forward pass. Each voxel face is represented as 2 triangles. The shader reads the surfel irradiance values and does manual per-fragment bilinear interpolation between them.

Acknowledgements

The font used in luminal spaces is Versatylo Rounded.

Updated 7 days ago
Published 12 days ago
StatusIn development
PlatformsWindows, Linux
Authorlisyarus
GenreSimulation
TagsCreative, Voxel

Download

Download
luminal-spaces-0.2.0-windows.zip 8.8 MB
Download
luminal-spaces-0.2.0-linux.zip 7.1 MB

Development log