Procedural 3D
This page is a brief summary of the explorations I have done in procedural 3D geometry and animation.
I have spent a lot of time in Unity writing games/demos (both personally and professionally), doing music visualizations, projection mapping, etc. However, I always felt that the workflow in game engines is quite restricted compared to the “immediate mode” style programming you get in frameworks like p5js or openFrameworks. At the same time, there is a significant limit (of the CPU/GPU) in creating complex geometry in immediate mode style 3D programming. After being aware of the limits of both paradigms, I began writing a procedural 3D library from scratch (using C# in Unity, but with minimal dependency on Unity), to allow myself to conduct experiments in geometry without having to change applications/frameworks, while also being able to create real-time applications using the same.
I started by implementing a novel L-System (not really an L-System, but very similar) where rules can be specified using graphs that can contain transformations, arbitrary C# scripts, arbitrary data, and recursive references. One of my first experiments with this system was to fractalize the pyramids of Giza (images below).



Creating fractals is generally done in an “analytical fashion”, where shapes are described implicitly by functions (e.g., when raymarching in shaders, or in programs like Mandelbulb3D). I realized I could create “discrete fractals” by using an recursive approach with discrete geometry (3D models, either created externally, or procedurally). I continued doing more experiments, adding parameters to control the recursion in interesting ways, and adding procedural meshing techniques to create things like abstract sculptures, trees and cityscapes. The images below show some more renders of outputs from this “graph-based L-System”. (Fun fact: even the m × n grid layouts that look like a nested for-loop were created with the L-System)









I then explored combining this approach with other experiments I had been doing, like procedural animation, shaders, and tree generation. One interesting aspect of this recursive system is that I can model different systems separately and combine them together (e.g., cityscape generator combined with tree generator, expressed as a new, single L-System with no new code)
Lately I have been more interested in assembling simple systems to create, complex chaotic systems. I find it very pleasant to “think in parameter space”, e.g., custom coordinate systems that are not euclidean - systems that transform a cube into a helix, or into a sphere and so on. Combining such systems is akin to “multiplying functions”, and allows me to create things like “helix around a circle around a cube around a tree around a 3D model of a head”, although one can easily hit the limits of renderable geometry if there are too many factors in the composition. Below are a couple animations that show the effect of changing a parameter in such a system.
“Chungi” is a game played by children in Nepal by tying together rubber bands, in a setup similar to “hackey sack”
One of the primitives in my meshing API, video demonstrates the effect of changing parameters. The shape is a cube in a curved parameter space.
Composition of a tree system with a helix around a circle, animated by changing the reference point in the helix.
A system consisting of rotating circles stacked on top of each other. Animation through changing the radii and phase parameters of various circles.
A “cube worm” dancing in space
Here are a couple more procedural generation/animation experiments, inspired by Escher’s drawings of the Trefoil Knot and the Moebius Strip.
The images below are various experiments in procedural geometry continued.













