Nebelmesser's Playground

Computational Sublime

4D Stereo Viewer

4D Stereo Viewer w Matryoshka

4D Viewer w. Tesseract

A 4D viewer. Open the live page or the local 4d/viewer.html.

A tesseract is two ordinary cubes sitting at W = −1 and W = +1, with matching corners joined by edges that run only along W. The viewer rotates that object in four dimensions, projects it down to 3D, and draws the result. Blue is the negative-W cube, red is the positive-W cube. Edges that cross W interpolate from one color to the other.

The camera then looks at that 3D picture — either as a single view or as a stereo pair, so the 4D shape can be seen with depth. Dolls and filled cubes are translucent so the W-axis (and the other copy) stays visible in stereo.

Inspiration

Visualizing 4D part 3: Projections and Perspective

Stereo

The bar at the top picks the layout:

Stereo strength is the eye separation. The convergence plane sits on the object, so changing the slider should not make the object slide sideways.

Rotation

4D rotations happen in a plane spanned by two axes. The viewer exposes the usual six: XY, XZ, YZ in ordinary 3-space, and XW, YW, ZW into the fourth axis.

Input Plane
Drag, or one finger XZ · YZ (3D orbit; W is held still)
Shift + drag, two-finger pan, or scroll XW · YW
Shift + scroll, pinch, or trackpad pinch ZW

On a phone, Tilt rotates (in the menu) maps device motion onto a plane:

Invert tilt flips the sense. While a finger is down, tilt is locked so the two inputs do not fight. iOS asks for motion permission on the first tap.

The hamburger opens the settings (always open on a wide desktop):

The tesseract still draws W-edges between matching cube corners. The doll does not: the two translucent copies and stereo parallax are enough to read W.

Axes

The HUD at the bottom is the same four axes after the current 4D rotation: X red, Y green, Z blue, W yellow. An axis that points nearly at the camera becomes a circle instead of an arrow (solid if it points toward you, dashed if it points away).

License

MIT. Made by Nebelmesser.