Building a ray tracer in Javascript
summary
A tiny JavaScript ray tracer renders a scene of spheres with shadows, mirror reflections and refractions by shooting one ray per pixel from the camera, testing intersections with each object and recursively casting reflection/refraction rays. Implementation uses basic math (sphere intersection), outputs visible but noisy, non‑photoreal results and needs multiple samples for anti‑aliasing. Claim: ray tracing is trivial to implement but computationally heavy; a 149‑character business‑card version exists. Practical alternatives discussed: rasterization via WebGL/A‑Frame, glTF assets, and normal maps to fake detail for web performance.
AI-written summary · about
