Most 3D engines draw triangles. A model is a mesh of thousands of them, built in a modeling tool, and the GPU fills in each one. Fabric Engine, the Rust engine I'm building for Wyrdloom Studios, draws no triangle meshes for its models. Every model is a small tree of mathematical shapes, and the GPU solves each shape's exact surface for every pixel.
This article explains how that works, and why it suits the stylized 3D pixel-art look of our first game, Faryn. The engine's code is private, so this is a walk through the ideas rather than the source.
A Fabric model is a tree of nodes. Each node has a position and rotation relative to its parent, animation offsets with limits, and a material: color, roughness, metalness, index of refraction, subsurface scattering, emission, edge rounding, and animated procedural noise.
Each node is one of eight shapes: a box, ellipsoid, cylinder, pyramid, cone, bowl, pipe, or hollow box. A character might be an ellipsoid head on a rounded box body, with cylinders for limbs. Changing a model in the Fabric Creator editor means changing numbers, such as a size, an offset, or a rounding, not reshaping a mesh.
The GPU still needs something to rasterize, so each node is drawn as a simple cube, 36 vertices generated in the vertex shader with no vertex buffer. The whole scene is one instanced draw call, with one cube instance per node.
The cube is a stand-in, not the shape. It is sized from the shape's bounding sphere, so it encloses the shape at any rotation. Its only job is to make the GPU run the fragment shader on every pixel where the real shape could appear.
For each of those pixels, the fragment shader casts a ray from the camera through the pixel and solves where it hits the real shape:
There is no ray marching here. Ray marching steps along a ray until it gets close enough to a surface, which costs many steps per pixel and gives an approximate answer. A closed-form intersection costs a few operations and gives the exact one.
The pass writes a G-buffer: color, normal, position, depth, and the id of the node under each pixel. The ids also let the editor know which node is under the cursor, so picking needs no extra work.
Faryn's look is 3D pixel art, with the scene appearing to be built from small cubes. Rather than modeling voxels, Fabric creates them from the image:
Because the voxels come from the screen rather than the models, the pixel-art style holds at any camera distance, and the models themselves stay exact.
The global illumination pass traces rays against the same eight shapes, with the same exact intersection math, using low-discrepancy sampling for indirect light and ambient occlusion. One set of shape definitions serves drawing, lighting, and picking.
This approach fits a game built from simple, stylized shapes. It would be the wrong choice for detailed, organic models, where meshes are the better tool. The engine keeps a polygon renderer for that reason, although it is not used today.
What it gives Fabric:
With most of the engine's work in WGSL shaders, a shader error is as serious as a Rust error. Every shader is parsed and validated with naga as part of cargo test, so a broken shader fails the build instead of crashing the game.
You can see an early look at the engine in the first development video, and follow along on Wyrdloom Studios' YouTube channel.
You can also come chat with us on the Stoic Dreams discord server.