Repository navigation
Ray Tracing
The Photorealistic tab ray traces the scene with MeerCADRaytracer. The image shows the same models, materials and lights as the WebGL view, and adds the shadows and reflections that the WebGL view leaves out. It can replace the main view or appear in a separate window.

Choose where to show it in Show ray traced image, or use the first three buttons on the Ray tracing toolbar.
| Choice | Toolbar button | What you see |
|---|---|---|
| In the main view | Camera | The ray traced image replaces the WebGL image in the view. |
| In a separate window | Arrow out of a box | A new browser window shows the ray traced image. The main view goes back to WebGL. |
| Off (WebGL view only) | Crossed-out camera | Only the WebGL view. Tracing stops. |
A blocky preview appears first, then the image sharpens with every pass. Below the choice, a line such as Tracing: 12 of 64 samples, 3.4 s shows the progress, and changes to Done when it has finished.
Press Z to switch between the three.js (WebGL) view and the ray traced view in the main view, as in Blender. It works on any tab, and in the separate window, where it closes the window and goes back to the three.js view. Z does nothing while you're typing in a field or choosing from a list, and Ctrl+Z, Cmd+Z and Alt+Z are left alone.
You can keep working while it traces. You can rotate, pan and zoom, change lights and assign materials, and each change starts the image again from the preview.

The window follows the main view's camera, so rotate and zoom in the main view as usual. Because the main view stays in WebGL, light handles and the move control keep working there. Resize the window to change the image size. The line at the bottom shows the progress, and the window title shows the samples done.
Closing the window turns ray tracing off. If nothing opens, your browser has blocked the window: allow pop-up windows for the site and try again.
| Button | Action |
|---|---|
| Camera | Ray trace in the main view. |
| Arrow out of a box | Ray trace in a separate window. |
| Crossed-out camera | Turn ray tracing off. |
| Circular arrow | Start the image again. |
| Square | Stop tracing. The image keeps what has been traced so far. |
| Down arrow | Save the image, as it is now, as raytraced.png. Wait for Done for the cleanest image. |
Settings take effect at once and start the image again. The circular arrow on the Quality toolbar puts every setting back to its default.
| Setting | Effect | Default |
|---|---|---|
| Samples per pixel | How far the image is refined, from 1 to 4096. More samples give smoother edges, blurred reflections and transparency, but take longer. | 64 |
| Bounces | How many times light may be reflected or refracted, from 0 to 16. Glass and mirrors facing each other need more. | 4 |
| Resolution | Full screen resolution, Half or Quarter. Lower resolutions trace much faster and look blurred. | Full |
| Preview | Size of the blocks in the first, quick preview, or None. | Medium (4 × 4) |
| Worker threads | How many of your processor cores trace in parallel. | All but one, at most 8 |
| Setting | Effect |
|---|---|
| Shadows | From every object and light (the default), Only where Cast shadow is set, as in WebGL, or None. With the second, a light needs Cast shadow on, and the objects need to cast and receive shadows, which loaded models don't. |
| Global illumination | Light also bounces off ordinary surfaces, so colours bleed onto nearby objects and corners darken. It needs more samples to clear up: use 256 or more. |
| Setting | Effect |
|---|---|
| Tone mapping | How bright light is compressed into the image. Same as the main view uses Reinhard, as the WebGL view does. None shows the raw values, which are brighter. |
| Exposure | Brightens or darkens the image before tone mapping. It has no effect with tone mapping None. |
| Colour space | Same as the main view is linear, as the WebGL view is. sRGB gives the standard encoding most images use. |
| Background | The view's background shows the view's blue gradient behind the image, and saves it as transparent. Colour fills the background with Background colour. |
| Keep proportions in the separate window | On (the default), the separate window shows the scene in proportion, with more or less of it at the sides. Off, the image is stretched to fill the window. |
- Shadows. The WebGL view shows no shadows, because loaded objects don't cast them. The ray traced image does, unless Shadows is None.
- Reflections. Metallic and glossy materials reflect the other objects in the scene. Where a reflection sees nothing, it shows the material's environment map, or black without one. That's why metals can still look dark, as they do in the WebGL view.
- Glass. Mesh Physical materials with transmission let light through, tinted by their colour. With a thickness above 0, they also bend it, and glass coloured by absorption (glTF's attenuation colour and distance) gets darker the more glass the light passes through. Thick parts therefore look deeper than in the WebGL view, which can only estimate the thickness.
- No handles. In the main view, light handles and the move control aren't drawn. Use the separate window, or turn ray tracing off, to move lights by their handles.
- Same colours. With the default settings, matte surfaces lit directly look the same in both. The ray tracer uses three.js's own lighting formulas and the view's tone mapping.
Large images, more samples, more bounces and global illumination all take longer, and lower Resolution is the quickest way to speed up. Each change starts the image again at once, so tracing never holds up the editor.
Loading a very large model, or moving or changing one, makes the ray tracer prepare the geometry again, which can take a few seconds per million triangles. Changing the camera, lights, materials or settings doesn't.
Next: Saving your work