This ray trace simulator lets you visualise how light rays move through an optical system in real time. You can trace beams as they reflect, refract, and pass through lenses or surfaces to see how your setup bends and focuses light. Everything runs directly in your browser with no downloads required.
How to Use
Navigation: Click on the viewport to take control of the camera.
- W / A / S / D: Move the camera forward, left, backward, and right.
- Space / Shift: Fly up and down.
- Mouse: Look around.
- ESC: Release mouse control.
Scene Editing:
Use the sidebar to add Spheres and Cubes to the scene.
Select any object to modify its physical properties, such as color, roughness (how blurry reflections are), and emission (making it glow).
What You Are Observing
The power of this tool lies in switching between the three rendering modes. Each mode calculates light differently, revealing the history and math behind 3D graphics.
1.Ray Casting (Basic Visibility)
This is the simplest form of 3D rendering. The engine shoots a single ray from your eye through each pixel on the screen until it hits an object.
- What to look for: The image looks flat and “cartoonish.”
- Missing features: There are no shadows, no reflections, and no light bounces. Objects are simply “visible” or “not visible.”
2. Ray Tracing (Whitted-Style)
This technique introduces the concept of light bouncing. When a ray hits a surface, it can spawn new rays towards light sources (to check for shadows) or bounce off like a mirror (reflections).
- Hard Shadows: Look at the shadows on the ground; they have perfectly sharp edges. This is unnatural but computationally cheaper.
- Perfect Reflections: Mirrors look perfect, but they lack the subtle blur of real-world materials.
- Glass Refraction: You can see through transparent objects, but the lighting is still simplified.
3. Path Tracing (Global Illumination)
This is the “Gold Standard” of modern rendering. Instead of tracing just one or two rays, the engine fires thousands of rays that bounce randomly around the scene, mimicking the chaotic behavior of real photons.
- Soft Shadows: Shadows naturally become blurrier the further they are from the object, just like in real life.
- Global Illumination (Color Bleeding): Place a bright red ball next to a white wall. You will see a subtle red tint on the wall as light bounces off the ball and hits the surface.
- Glossy Reflections: Adjust the “Roughness” slider. Unlike Ray Tracing, Path Tracing can simulate rough metals and frosted glass by scattering light rays in random directions.
- Note: You will see “noise” or graininess that slowly clears up. This is the engine accumulating samples over time to converge on a perfect image.
