doubleray

WASM raytracer

Usage no npm install needed!

<script type="module">
  import doubleray from 'https://cdn.skypack.dev/doubleray';
</script>

README

DoubleRay raytracer

This project came from a homework assignment I had 12 years ago in my undergraduate computer graphics class (UC Davis ECS175). The purpose of this project is to modernize and package the raytracer for use in the browser via WASM. In general I had the idea that this should be able to render semi-realtime, however I'm not sure it's there yet. The name (Double Ray) is just a play on the double precision float datatype.

Live Preview

Click this live preview to render your own images.

Images

Project Priorities

These are the priorities I kept in mind through development:

  • Correctness
  • Ease of Use
  • Performance
  • Code cleanliness

State of things

Currently the project is a bit limited in functionality, but it does support:

  • Spheres only
  • Reflection, Refraction, Diffuse, Specular (phong), light shadows
  • Light sources are a direction only, and have no origin
  • Multiple shadowing modes

Things I want to add

  • Poloygon support (triangles)
  • Bounding boxes to improve performance
  • Diffuse shading that includes reflection from lights
  • Spherical light model
  • Change FOV (currently fixed at 53.0155)

How to use this project

  • I'm still trying to understand the best way to publish / include this project.

Travis Details

The emscripten travis docker image has some weird issues with clang that I do not understand. I have opted to use two docker images, one for the png tests, and one to build the wasm.

Build Status

Compile

make

Run

cd out
sudo python -m SimpleHTTPServer 80

open ray.html in firefox (chrome is slower for me)

Notes

We use template/controls.html to generate ray.html

Deps

On ubuntu:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk/
git pull
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
realpath ./emsdk_env.sh 

Instructions from: https://emscripten.org/docs/getting_started/downloads.html

See Also Ratracing

See Also Emscripten

See Also Offtopic

Libraries Used