A simple, naive path tracer in JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
images
scenes
scripts
.DS_Store
.gitignore
index.html
package.json
readme.md
yarn.lock

readme.md

JavaScript Path Tracer

A very simple path tracer in the browser with zero dependencies.

Path tracing is a technique that simulates the behavior of light to render photorealistic images:

output

Scenes

Features

  • Unbiased monte carlo integration
  • Adaptive sampling
  • Russian roulette
  • Physically based materials
    • Fresnel reflection, transmission, absorption, diffusion
    • Color, index of refraction, gloss, transparency, separate fresnel channels, metals
  • Arbitrary light sources
  • Physically based camera
    • sensor, aperture, focus, depth of field
  • Antialiasing
  • Spherical environment maps

Code

The renderer is about 430 lines written for readability, not terseness. The core components of any monte carlo path tracer are its trace function and Bidirectional Scattering Distribution Function (bsdf).

Running locally

$ git clone https://github.com/hunterloftis/pathtracer.git
$ cd pathtracer
$ yarn install
$ yarn start
$ open localhost:8000