Skip to content

Shape3d - pure C# mesh renderer

A renderer that draws figures which cannot exist.

Twenty primitives and a short cast of impossible figures - the Penrose staircase, the tribar, an Escher loop - each one a real list of 3D triangles that only reads as impossible from a single camera. Rotate it and the illusion pulls itself apart. No engine, no WebGL, no packages outside the .NET base library: the whole thing rasterises to a 2D canvas.

Penrose staircase rendered from the one viewpoint where its four flights close into a single loop that appears to climb forever.
penrose-stairs - the one camera where the loop closes - orthographic - 224 verts / 336 tris
20
shapes in the catalog
4
C# projects, 1,214 lines
0
dependencies beyond the BCL
2D
canvas raster, no shaders

Under the hood

Why the impossible ones work

01 Honest geometry

Every figure is a genuine set of 3D vertices and triangles. Nothing is drawn in 2D and nothing is faked - you can export any of them to OBJ or STL and open them in a modeller.

02 The camera does the lying

Orthographic projection throws away depth, so a corner sitting far behind another lands on exactly the same pixels. Line the pieces up that way and a broken loop looks whole. Add perspective, or turn a few degrees, and the gap returns.

03 A 2D rasteriser

Faces are depth-sorted back to front, back-faces culled, lit by one directional light, and painted onto a plain canvas. No GPU, no shader, no matrix library - just arithmetic from the base class library.