What's in the Viewbox?

Four is an interactive real-time renderer for 4D objects. The rendering pipeline generalizes the standard computer graphics pipeline for 3D objects. The camera sits inside of 4D space. Objects are projected to a 3D hyperplane and rasterized to produce a volumetric image, which then gets passed to the standard 3D→2D rendering pipeline.

Four is still in a rudimentary state. Currently, basic rendering for hypersurfaces and codimension-2 surfaces has been implemented. This widget allows the user to select from a preset list of regular convex polytopes—the 5 cell/simplex, the 8-cell/hypercube, and the 16-cell/orthoplex—as well as a few codimension-2 surfaces—an embedded \(\mathbb{RP}^2\) and a more complicated genus 1 surface. Four is coded using a combination of Javascript and WebGL. Mathematical and design direction are by me. Most of the code is written by Claude.

Camera Controls

There are currently three control schemes for the camera. All three use a pair of quaternions controlled by a pair of trackballs to rotate the camera, but each works in a different way.

  1. Flight mode. The most intuitive mode (though that's not saying much). Similar to the controls used in flight simulators. The "look" trackball controls what direction the camera faces, while the "roll" trackball spins the camera without changing the look direction. All rotations are measured relative to the camera's own coordinate frame. The keyboard can also be used to control the camera in this mode.
  2. \(S^3\) adjoint. Similar to flight mode in that one trackball controls the camera's look direction and the other rolls the camera while keeping that direction fixed, but instead of rotating relative to the camera's own frame, this mode modifies the frame in world coordinates by exploiting the Lie group structure on \(S^3\). The space of possible look directions in 4D is \(S^3\); left-multiplying by a unit quaternion produces a new look direction, and the adjoint action rolls the orthogonal hyperplane.
  3. \(\operatorname{Spin}(4)\). The most mathematically natural mode but the least intuitive to use. It exploits the isomorphism of spin groups \(\operatorname{Spin}(4)\cong\operatorname{Spin}(3)\times\operatorname{Spin}(3)\) to produce an arbitrary 4D rotation of the camera frame via a pair of unit quaternions \(q_L, q_R\) acting on the left and right. The two trackballs correspond directly to these two \(S^3\) factors.

The keyboard can be used to fly the camera through 4D space in any mode. The buttons at the bottom of the control panel reset the camera position and recenter its view.