Skip to content
GMT
10 · Tutorial · 9 min read

The Modular Formula Builder

Build a custom fractal in the node graph editor — no code required.

What the Modular does

Most formulas are fixed equations. The Mandelbulb iterates z → z8 + c. You can't rearrange it.

The Modular formula is different. It's a node-based editor where you build the iteration loop yourself by chaining operations:

z → Rotate → BoxFold → Scale → z8 + c

The graph compiles to GLSL on the fly and replaces the formula shader. You're effectively designing your own fractal.

Getting there

Open the Formula dropdown and pick Modular. A Graph tab appears in the right dock — that's the editor. You're now seeing a default preset, typically a Mandelbulb built from component nodes.

The node palette

Utils

  • Comment / Note — documentation blocks inside the graph
  • Add C — adds the constant c term (Julia / Pixel mode switching)

Transforms

  • Scale (Mult) / IFS Scale (Homothety) — resize space
  • Rotate — rotate coordinate system
  • Translate — shift space
  • Modulo (Repeat) — tile space infinitely

Folds

Folds are the heart of most non-power fractals — they reflect space across planes.

  • Amazing Fold, Abs (Mirror), Box Fold, Sphere Fold
  • Plane Fold, Menger Fold, Sierpinski Fold

Fractals

  • Mandelbulb — the classic power iteration as a node

Primitives

These write an SDF distance value that can override the iterative DE:

  • Sphere, Box

Distortion

  • Twist (Z), Bend (Y), Sine Wave

Combiners (CSG)

These take two inputs and merge them:

  • Union, Subtract, Intersect, Smooth Union, Mix (Lerp)

Adding nodes — Ghost Insert mode

  1. Pick a node type from the "Add:" dropdown or the right-click context menu
  2. A ghost tooltip follows your mouse — cursor becomes a crosshair
  3. Click on an existing connection (highlighted cyan) to insert the node between its neighbors; the edge splits automatically
  4. Click on empty canvas to place the node freely at that point
  5. Esc to cancel

CSG / Combiner nodes need two inputs, so they can't be edge-inserted — click empty canvas to drop one in, then wire inputs manually.

Wiring connections

  • Drag from a node's bottom handle (output) to another's top handle (input)
  • CSG nodes have two top handles — A (left) and B (right)
  • The chain starts at Input Z and ends at Output Distance
  • Right-click a connection to delete it
  • Cycles are prevented — you can't wire a node's output back into its own chain

Per-node controls

  • Enable/Disable checkbox — temporarily bypass a node without deleting it. The card dims.
  • × button — delete the node and reconnect its chain automatically (for single-input nodes)
  • Right-click header — context menu with delete + help

The two hidden-but-essential node features

Parameter binding (A–F)

Every slider on every node has a dropdown next to it. Set it to A, B, ..., F to link that parameter to the corresponding global slider. Now it's driven by the main Formula panel — and because global sliders are animatable, you can keyframe deep graph parameters from the Timeline.

Bound parameters display in cyan with a (→ ParamX) label. Pick "—" to clear the binding.

Logic / Condition (per-iteration firing)

Expand the Logic section at the bottom of any node. Enable it, then set:

  • Interval — node fires every N iterations
  • Starting Iteration — which iteration in the cycle to start on

Example: Interval 3, Start 1 → runs on iterations 1, 4, 7, 10, ... This is how you create layered hybrid fractals inside a single graph — folds that alternate with power iterations, transforms that only apply periodically.

Compile controls

  • Auto Compile — recompiles the shader after every structural change. Convenient but slower to work with on big graphs.
  • COMPILE — manual compile button. Pulses when changes are pending.
  • Ctrl+Z / Ctrl+Y — undo/redo graph changes including node positions
  • MiniMap — overview in the corner, color-coded by category

Load a preset to start

The "Load:" dropdown has pre-built chains as starting points:

  • Mandelbulb (Standard), Amazing Box, MixPinski
  • Menger Sponge, Kleinian, Marble Marcher

Start with one of these, tweak, and learn by modification. Much faster than building from scratch.

What to try first: load Amazing Box, then insert a Rotate node between two of the fold steps. Bind its angle to Parameter A. Animate A on the Timeline. You've just made an animated hybrid fractal that doesn't exist in the built-in library.

Exporting a Modular formula

Save a scene with the System Menu — GMT writes the compiled GLSL into the .gmf file, so anyone loading it gets your exact formula, not a re-resolved version of the graph.

If you want to share just the graph structure (not a rendered scene), the .gmf file still carries it — other users can open it in the Modular editor and continue modifying.

Where to go from here

The Modular is where GMT becomes a real tool for designing fractals, not just exploring them. It rewards experimentation — swap nodes, bind to sliders, animate. Most of the interesting shapes in the community have been discovered by people dragging nodes around and seeing what happens.