OPTICS BENCHray tracer
Bounces12
6.0 m
Loss/bounce 0%
Drag to orbit · shift-drag to pan · wheel to zoom · edit in 2D

OPTICS BENCH

Specular ray tracing on a metric bench. Every surface is stored as its exact curve, so reflections use the true analytic normal — a parabola focuses to a point, a sphere shows its caustic.

Working in 2D

Click a surfaceAdd it at the centre of the view
Drag body / centreMove it
Drag pink handleRotate it
Drag end squaresTrim the surface back
Alt / Ctrl dragFine: a tenth of the pointer movement
Shift while draggingSnap to grid / 15°
Wheel · drag emptyZoom · pan

Working precisely

Hold alt or ctrl while dragging and the shape follows a tenth of your pointer movement — release and re-press the key mid-drag as often as you like, it re-anchors instead of jumping. The same modifier gives a slow wheel zoom. Arrow keys nudge in a decade ladder, 0.1 mm to 10 mm, and Q/E rotate the same way. Every number box in the inspector accepts typed values with no limit and steps in 1 mm or 0.05°, so the slider beside it is only ever the coarse control.

Measuring

Measure mode: click two points; a green ring means you snapped to a vertex, a focus, or a ray hit. Set scale: click two points and type what that span should be — the bench rescales so your numbers are real.

Receivers

A Receiver swallows every ray that reaches it and reports what fraction of the beam that was. The figure floats over it on the canvas and appears again in the inspector, split beam by beam with a bar for each, so you can see which source is actually landing. It also gives the spot about its centre, rms and worst case, in millimetres — the number you want when you are sizing a detector rather than just aiming at one.

Any shape can be one: set Behaviour to Receiver and a curved surface becomes a curved detector. In 3D it counts the 3D trace, so the aperture is a real area rather than a length, and the percentage changes accordingly. The count is of rays, not power; with Fresnel on, the weighted figure appears underneath.

Glass

Set any closed shape's behaviour to Glass and it refracts instead of reflecting. Snell's law decides the bend, and which side of the surface the ray is on decides the direction: a circle becomes a ball lens, an ellipse an ellipsoidal one. Past the critical angle nothing gets out and the ray totally internally reflects, which is the whole trick behind the prism and the TIR collimator. The index slider runs from 1 to 4 — glass, acrylic, silicon.

The library adds four bodies built for it. Lens takes a front and back radius, an aperture and a centre thickness, so one entry covers biconvex, biconcave, plano- and meniscus (a radius of 0 is a flat face), and the inspector reports the lensmaker focal length as you drag. Dome is a half-ball, flat face toward −x. Prism is an isosceles triangle: 60° to disperse, 90° to fold a beam by total internal reflection. TIR collimator is the LED optic — put a source on its S mark and the middle refracts while the sides bounce.

Fresnel in the toolbar adds the partial reflection every real glass surface makes, at the strength the Fresnel equations give. Those ghosts are what you chase when a lens sits in front of a mirror. The main beam is not dimmed to pay for them, so treat the ghosts as relative, not as an energy budget.

X cuts and Y cuts

The half shapes come in pairs. Half parabola X and Half ellipse X are cut along the axis and keep the upper half. Half parabola Y and Half ellipse Y are cut across the axis, at a position you set: the parabola keeps either its outer arms (a ring once revolved) or its vertex bowl, the ellipse keeps either the cap at the +x end or everything before the cut. Slide the cut to the centre and you get the plain right or left half.

A cut never moves the foci, and a focus stranded on the discarded side stays marked — for the ellipse, rays from that focus still reflect off what is left and land on the other one. The half circle needs no pair: an arc plus a rotation already reaches every cut.

Flip about the axis, in the inspector, mirrors any shape across its own x axis. Rotation alone cannot do this, so it is the only way to get the opposite half of a half shape.

Guides

Half shapes draw the half you removed as a dashed outline, so you can see the whole conic the mirror was cut from — and both foci stay marked, even the one on the missing side. The hyperbola also draws its far branch and its asymptotes. Guides never reflect anything; turn them off with the Guides box or U.

Fading the beam

Brightness falls off along the path as exp(−s/L), where s is the distance the ray has travelled and L is the fade length. Inside a circle or an ellipse this separates the first pass from the fifth: shorten L until only the bounces you care about are left. Loss/bounce dims the ray a further fixed fraction at every reflection, which is what a real mirror stack does. A ray is dropped once it falls below about 1.5% brightness, so a short fade length also speeds up the view.

Trimming

A parabola whose arms run past the edge of your test, or an ellipse you only want a slice of: select it and drag the small square at either end along the curve. Everything past the square is deleted — not drawn, not traced, not pickable. The two Trim fields in the inspector do the same thing to 0.1% if you want it exact, and Restore brings the full shape back. The inspector reports how much reflecting surface is left, in metres.

Trimming is destructive on purpose; cuts are not. Use a trim to shorten a mirror, a cut to put a hole in one.

Cuts and pinholes

Each cut removes a span of the surface, given as a fraction along the curve. Rays pass straight through the gap. Pinhole sets two cuts either side of a narrow slit; drag the sliders to open or close it.

3D

Every profile sweeps into a solid: revolve about its optical axis (paraboloid, ellipsoid, cone) or extrude sideways into a trough. Rays are traced in full 3D against that surface. Editing stays in the 2D view.

Each body carries its own colour, listed against its name in the scene panel and editable under 3D body. Bodies are shaded matter; beams stay bright and glowing, so the two never read as the same thing. Surfaces and beams are painted in one depth order, so a ray running behind a mirror is hidden by it rather than drawn over the top. Turn off Solid 3D for the bare wireframe, where nothing hides anything.

A body is aimed with three angles. Rotation is the yaw the 2D view shows; tilt and roll are 3D only and take it off the bench plane. Tilt swings the axis of a revolved solid, roll tips a flat plate, trough or prism, and each does nothing to the other family. Beams take a tilt too. Every angle slider is endless: drag it to either end, let go, and it recentres for another turn, so you can wind a body round as many times as you like — or type the angle straight into the box.

Keys

V · MSelect · Measure
2 · 32D · 3D view
ArrowsNudge 1 mm · shift 10 mm · alt 0.1 mm
Q · ERotate 0.5° · shift 5° · alt 0.05°
D · DeleteDuplicate · Delete
G · F · NGrid · Foci · Normals
A · U · RFade · Guides · Fresnel on / off