Skip to content

Repository files navigation

Photon 🌈

Create expressive procedural voxel scenes in code and bring them to life with physically based path tracing on the web. Photon is a code-first voxel scene authoring and rendering framework built around procedural generation and GPU-accelerated path tracing with WebGPU.

Warning

This project is currently under active development and all APIs are subject to change. You are welcome to check it out, but should not use it for serious projects yet.

Demo

Authoring ✨

Build voxel scenes entirely from code by combining simple primitives and procedural generators into complex structures. Rather than manually placing thousands of voxels, you describe the rules that produce them using strongly-typed functions.

const white = material({
  color: [1, 1, 1],
});

const emissive = material({
  color: [1, 0.22, 0.03],
  emission: {
    color: [1, 0.16, 0.015],
    strength: 20,
  },
});

const scene = group(
  pyramid({
    position: [0, 0, 0],
    height: 10,
    material: white,
  }),
  voxel({
    position: [0, 3, -7],
    material: emissive,
  }),
);

The authoring layer provides composable building blocks that can be reused, nested and combined as you wish:

Concept Purpose
🎨 Materials Define how generated surfaces interact with light.
🧊 Primitives Basic building blocks from which voxel geometry can be created.
βš™οΈ Generators Procedurally produce custom geometry according to your own algorithms.
πŸ“¦ Groups Compose multiple elements into reusable, hierarchical structures.

Photon's goal is to make modeling feel more like programming than traditional 3D authoring: define rules, compose them, and let the scene emerge from code.

Rendering πŸ–₯️

Capabilities

  • ⚑ GPU-accelerated path tracing from a sparse voxel octree
  • πŸ”„ Progressive accumulation for converging renders
    • Stochastic anti-aliasing
  • πŸ’‘ Physically based light transport with global illumination
  • 🎨 BSDF material pipeline
    • Diffuse reflection β€” Lambertian-style diffuse light scattering
    • Metallic reflection β€” Ideal smooth mirror reflection
    • Emission β€” Glowing surfaces can emit radiance
  • β˜€οΈ Sun and gradient-sky environment lighting, including hard or soft shadows
  • πŸ“· Perspective and orthographic cameras
  • βš™οΈ Adaptive, GPU-budget-aware scheduling with tiled rendering
  • πŸ“Š Live rendering telemetry for progress, timing and scheduling state

License

This software is provided under the MIT license.

About

🌈 Create expressive procedural voxel scenes in code and bring them to life with physically based path tracing on the web.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages