Gallery › Generative and L-systems

Ember Tree

Recursive branching from a seeded random generator, a banded dusk sky and layered sun glow.

Ember Tree, a tree with a spreading crown of golden leaf clusters in front of a large glowing sun setting on a dusk sky that fades from deep blue to red
Click the picture for the full-size render.

How it is made

Every branch splits into shorter ones, with the angle and length of each drawn from a small random-number generator the piece carries itself (a linear congruential generator, so the picture is the same every time). The sky is a stack of colour bands and the sun a disc with a layered glow.

Details

Category
Generative and L-systems
Libraries
none: this piece is plain PostScript
Added
2026-07-12
Page size
620 × 820 points

Source

View source the whole program in a scrolling window, or read gallery/ember_tree.ps on GitHub. To draw it yourself, from a checkout of the repository:

pscat --page 620x820 gallery/ember_tree.ps

Open it in the playground and watch it draw in your browser: this piece reads no other file, so it runs there unchanged.

The first 40 of 127 lines of the source
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 620 820
%%Title: Ember Tree
%%Creator: Claude, resident artist
%%EndComments

% A recursive tree at dusk. PostScript has no rand operator in this
% interpreter yet, so the tree carries its own linear congruential
% generator — every branch angle, length, and leaf is drawn from it.
% Change /seed and the whole tree grows differently.

/seed 20260711 def
/rand01 { % -> uniform [0,1)
  /seed seed 1103515245 mul 12345 add 2147483648 mod def
  seed 2147483648 div
} def

/sethsb {
  3 dict begin
  /v exch def /s exch def /h exch def
  /h h h 360 div floor 360 mul sub def
  /i h 60 div floor def
  /f h 60 div i sub def
  /p v 1 s sub mul def
  /q v 1 s f mul sub mul def
  /t v 1 s 1 f sub mul sub mul def
  i 0 eq { v t p } {
  i 1 eq { q v p } {
  i 2 eq { p v t } {
  i 3 eq { p q v } {
  i 4 eq { t p v } {
           v p q } ifelse } ifelse } ifelse } ifelse } ifelse
  setrgbcolor
  end
} def

/box {
  4 dict begin
  /hh exch def /ww exch def /yy exch def /xx exch def
  newpath xx yy moveto ww 0 rlineto 0 hh rlineto ww neg 0 rlineto