# SEH3

## Introduction

I once saw a depiction of R’lyeh on which the artist had noted that he didn’t know what non-euclidean geometry looks like and had therefore just tried to draw the most nightmarish place he could imagine. As a mathematician I knew a few things about non-euclidean geometries. But even I didn’t know what it would be like to visit a non-euclidean city.

Fortunately I’m also a software developer. A craft which enables me to envision realms not only beyond reality, but even beyond my own imagination.

I’m developing a rendering engine for spaces of constant curvature — spherical, euclidean, and hyperbolic space — in three dimensions. This is of course the holy grail of Lovecraft-inspired games. It also provides a unique tool for teaching non-euclidean geometries and an unprecedented opportunity for psychological research on orientation. And of course SEH3 is a representative project showcasing my unique interests and skills.

SEH3 is written in Javascript using a canvas element for drawing. This choice was made to make it easily accessible to a wide audience. No download or plugins are required.

## How it works

In SEH3 Möbius transformations of quaternions, restricted to the imaginary space, are used where other 3D engines use affine linear transformations. Spherical space is represented as its stereographic projection, hyperbolic space as its Poincaré ball model. The player moves in these spaces by application of the right groups of Möbius transformations. In either case, space is transformed so that the eye point is mapped to the origin. That way geodesics through the eye point are mapped to straight lines. So rendering from then on works just as for Euclidean space.

## Features

- Spherical geometry (S
^{3}) - Euclidean geometry (E
^{3}) - Hyperbolic geometry (H
^{3}) - 3D polygons
- Back face culling
- Binary space partitioning
- Painter’s algorithm

## Missing features (to do)

- Portals
- Flat shading
- Gouraud shading
- Collision detection
- Billboards
- Developer documentation

## Missing features

- Intuitive level editor. Building non-euclidean worlds may always require mathematical calculation.
- See that logo up there? A variant of a Penrose triangle. I don’t know how to make a 3D version of that. With portals, it’s trivial to build a non-simply connected space with an actual Penrose triangle in it, but it wouldn’t look like the popular 2D image of one. Instead it would look like an infinite spiral.