Skip to content
VeiledTeePublic

About

An evolutionary computation system that allows users to evolve 3D shapes through a graphical user interface, and then save them to their machines for 3D printing

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Bre3Der

An interactive 3D evolutionary art system. Users co-evolve unique 3D-printable shapes with a genetic algorithm — no fitness function required. Built to test whether Stanley & Lehman's "Myth of the Objective" findings from 2D Picbreeder generalise to three dimensions.

This is the codebase for my undergraduate honors thesis at Saint Francis Xavier University (Bachelor of Science with Advanced Major in Computer Science, April 2022). Supervised by Dr. James Hughes; second reader Dr. Jean-Alexis Delamer.

📄 Thesis: Heavey, E. (2022). Bre3Der. Bachelor of Science honors thesis, St. Francis Xavier University.

The big idea

In their book Why Greatness Cannot Be Planned: The Myth of the Objective, Kenneth Stanley and Joel Lehman argue — using their 2D evolutionary art system Picbreeder as primary evidence — that interesting discoveries often can't be reached by deliberately optimising for them. The car-shaped image that emerged from breeding alien-face images on Picbreeder could not be re-evolved when researchers started over and tried to deliberately steer toward it.

The research question Bre3Der is built around: does that observation hold in three dimensions?

To find out, I built an end-to-end 3D evolutionary art system that lets users breed shapes through a tkinter GUI, save them as STL files (3D-printable), and trace their lineage via auto-generated phylogenetic trees — then ran a 3D version of Picbreeder's "Story of the Car" experiment.

(See Figure 3.5 in the thesis — the first shape evolved by Bre3Der, 3D-printed and held in hand.)

How it works

Bre3Der is a genetic algorithm with two deliberate omissions from the textbook GA recipe:

  • No fitness function. 3D aesthetic quality isn't a function you can write down, so the user is the selection pressure. At each generation, the user picks the shape they like best and the next generation is bred from it.
  • No crossover operator. The shape genotype is a numpy-stl mesh — an unordered list of triangles, each defined by 3 (x, y, z) coordinates — and meshes from different parents have different triangle counts in different orders. There's no meaningful way to "splice" two such meshes without producing nonsense. The thesis discusses this in Section 3.5.
flowchart LR
    A[Username] --> B[Init mode]
    B --> C1[From scratch:<br/>cube or pyramid]
    B --> C2[Random existing<br/>shape from corpus]
    B --> C3[From file:<br/>specific .stl]
    C1 --> D[Population of 10<br/>numpy-stl meshes]
    C2 --> D
    C3 --> D
    D --> E[Render 10 shapes<br/>in tkinter GUI]
    E --> F{User picks<br/>favourite}
    F -->|Evolve| G[10 deep copies<br/>of selected parent]
    G --> H[Apply mutations:<br/>add/multiply points,<br/>break-up triangle,<br/>delete triangle/point]
    H --> D
    F -->|Save| I[Write .stl +<br/>append to<br/>phylogenetic.csv]
Loading

Mutations

Each child is a deep copy of the chosen parent with one or more of the following applied:

  • add_points — for a random point [x, y, z], add a random offset in [−x/2, x/2] to each coordinate
  • multiply_points — multiply each coordinate by a factor in [0.1, 2] or [−2, −0.1] (50/50)
  • break_up_triangle — split a triangle into 4 sub-triangles at edge midpoints (controlled by T_RATE; gives later mutations more points to operate on)
  • delete_triangle — remove a random triangle (counter to additive bloat)
  • delete_point — remove every triangle connected to a randomly chosen vertex, creating a localised extinction event

Configurable parameters

Parameter Default Meaning
T_RATE 1.0 Probability that a triangle is split at each generation
T_DELETE 0.5 Probability that a random triangle is deleted
P_DELETE 0.25 Probability that all triangles around a random vertex are deleted
CSV_FILE phylogenetic.csv Where parent-child lineage is logged

The Bunker experiment

The headline experiment is a 3D replication of Picbreeder's "Story of the Car." I picked a previously-evolved shape called "Bunker" (originally bred by another user in 4 generations starting from a cube) and tried to deliberately re-evolve it from scratch — again starting from a cube, selecting at each step the shape that looked most like the target.

Attempt Generations used Result
Original Bunker (no target) 4 Original shape
Recreation attempt 1 14 Nowhere close
Recreation attempt 2 10 Nowhere close
Recreation attempt 3 23 Nowhere close

Across three attempts using substantially more generations than the original, none of the recreations resembled the Bunker. This is suggestive — not proof — that the path-dependence Stanley & Lehman observed in 2D image breeding shows up in 3D mesh breeding too. The full discussion is in Chapter 5 of the thesis.

Phylogenetic trees

Every shape Bre3Der saves writes a row to phylogenetic.csv recording its parent and the generation it was bred at. The tree.py script reads that CSV and generates ASCII phylogenetic trees rooted at the two from-scratch starting shapes (cube and pyramid):

Cube
├── _0000
│   └── _0002
│       └── bill_0005
├── frank_0000
│   └── bill_0004
├── john_0000
└── king_0000
    └── king_0001
        ├── _0008
        └── _0009

Files are named {username}_{4-digit-id}.stl so authorship and order are recoverable from filenames alone.

Setup

git clone https://github.com/VeiledTee/Bre3Der.git
cd Bre3Der
pip install -r requirements.txt

Major dependencies: numpy, numpy-stl, matplotlib, tkinter (stdlib).

Usage

python main.py

You'll be prompted for a username, then shown three initialisation choices: From Scratch (start from a cube or pyramid), Random Existing Shape (begin from a random previously-evolved shape in the corpus), or From File (resume from a specific saved .stl). From there, pick your favourite shape each generation and press Evolve; press Save when you want to stop. Your final shape is written to disk as {username}_{N}.stl — ready to 3D-print.

To generate phylogenetic trees from the saved lineage:

python tree.py

Citation

@thesis{heavey-2022-bre3der,
    author  = {Heavey, Ethan},
    title   = {{Bre3Der}},
    school  = {St. Francis Xavier University},
    address = {Antigonish, Nova Scotia, Canada},
    type    = {Bachelor of Science with Advanced Major in Computer Science honors thesis},
    year    = {2022},
    month   = apr,
    url     = {https://hdl.handle.net/20.500.14648/3984},
    note    = {stfxir:3647},
}

Acknowledgements

Supervised by Dr. James Hughes. Second reader Dr. Jean-Alexis Delamer agreed to step in on short notice.

About

An evolutionary computation system that allows users to evolve 3D shapes through a graphical user interface, and then save them to their machines for 3D printing

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages