Here's Tangerine, my main personal project:

This is a CSG system built around composing signed distance functions in Racket. These are translated to an evaluator that can be ran on the CPU, and generated shaders for fast rendering. Models can be rendered in real time, or exported to common file formats for other purposes like 3D printing.

I wrote a bit about how it works back in March:

Tangerine uses a strategy I call SDF decomposition, where models are first described as expression trees, and then are split into sets of expression trees that are likely to intersect a given volume element. The current version is using an octree to find the ideal volume elements. These are then used to generate shaders and/or export models.

To illustrate this, here is the cafe dollhouse from the first post.

In the first image, the color indicates what shader rendered the patch. This model has 128 generated shaders.

The second image shows the octree volume elements with an arbitrary coloration. Each voxel has a single shader that will render it.

The third image is the octree again, but with a grayscale coloration that indicates the number of shapes in the local CSG tree. Darker is better.

The renderer is moderately fast, models I've tried so far range from <1 ms to ~5ms on contemporary hardware. There are a number of ways this can be improved, like occlusion culling and improving the accuracy of the octree evaluator. I'm hopeful that the perf can be improved substantially from here.

Generating the SDF evaluator octree runs the range from nearly instant to a few seconds for the models I've made so far. The main pain point is OpenGL shader compiling being hard to make properly asynchronous. I'm hoping switching to Vulkan will give me more control over the parallelism of it, and making this non-blocking.

Anyways, there's a lot to do here, and I'll post about it more as I work on it and make things with it. My end goal is a real time rendering engine for procedural art where live edits can be made to CSG models as part of gameplay.

Sign in to participate in the conversation
Gamedev Mastodon

Mastodon server focused on game development and related topics.