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.
- 20
- shapes in the catalog
- 4
- C# projects, 1,214 lines
- 0
- dependencies beyond the BCL
- 2D
- canvas raster, no shaders
The main act
Impossible figures
Real meshes that lie about their geometry - valid from one angle, broken from every other.
For a few frames each turn the four flights meet in a square that seems to climb without end. Spin a little further and they spring into four ordinary staircases stranded at different heights - the hidden riser that resets the loop to the ground swings into view.
Off the magic viewpoint the cheat is plain: the flights never meet. One arm quietly drops its whole height at the corner the canonical camera keeps hidden.
The impossible triangle cannot be built in real space - so the mesh is three square bars that only line up in a flat drawing. Here the renderer shows the gap the printed illusion depends on hiding.
A plain block with the staircase loop dropped onto its roof, after M.C. Escher's 1960 lithograph. The building is ordinary; only the stairs break the rules.
The honest half
Primitives and attractors
The same rasteriser on shapes that play fair - parametric surfaces, a Platonic solid, a fractal, a chaotic orbit.
The smallest knot you cannot undo, swept as a tube along a (2,3) torus curve.
A UV donut, each ring sampled around a second ring - the textbook parametric surface.
Remove the middle of a cube, then do the same to each of the 400 pieces left behind.
The largest Platonic solid, built straight from the golden-ratio vertex coordinates.
The 1963 toy weather system, integrated step by step and drawn as a tube - two lobes, never quite repeating.
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.