A fairly simple raytracer made with TypeScript and WebGPU
- Browser and terminal rendering
- Lambertian and dielectric materials
- Textures with different interpolation modes
- GPU acceleration
- Optimized with a bounding volume hierarchy
Showcasing Lambertian and dielectric materials, as well as an interpolated texture
- Clone the repository
- Run
bun install - Either:
- Run
bun . <options...>to render from the terminal and output todist/output.png - Run
bun run devand open port 8000 in a browser.
- Run
- Size: horizontal and vertical resolution of the image
- Terminal:
-s <number> - Browser:
?s=<number>,?size=<number>,?resolution=<number>, or?res=<number>
- Terminal:
- Rays per frame: number of rays to send out per pixel per frame
- Terminal:
-r <number> - Browser:
?r=<number>or?rays=<number>
- Terminal:
- Bounces: number of bounces each ray makes before stopping
- Terminal:
-b <number> - Browser:
?b=<number>or?bounces=<number>
- Terminal:
- Stop time: minutes until the rendering stops
- Terminal:
-t <number> - Browser:
?t=<number>or?stop=<number>
- Terminal:
