← Back to projects
Bad Apple x GPU Instancing footage

Bad Apple x GPU Instancing

2024 · Independent Study · Solo Project

Overview

A final project for an independent study on shader programming: recreating the "Bad Apple" music video in real time using 1,000 GPU-instanced paper airplanes, each acting as a single pixel-like unit in the final image.

The Problem

Reproducing the video's black-and-white frames meant distributing airplanes to match population density: dense in dark regions, sparse in light ones. Without that, airplanes would simply pile up on top of each other in white regions instead of spreading out naturally.

Without accounting for population density, airplanes would pile up on top of each other in white regions instead of spreading out naturally.

The naive fix, each airplane checking every other airplane's position to space itself out, is O(n²) across 1,000 objects per frame, which is far too expensive to run in real time.

The Solution

A two-pass compute shader architecture replaces the pairwise comparison entirely. The first pass has every airplane log its screen position in parallel to build a population density map. The second pass has each airplane sample that density map directly, rather than iterating over every other airplane, to decide where to move. Each airplane updates its own transformation matrix independently through the compute shader, and the whole set is rendered with GPU instancing.

Result

A solo project delivering a real-time recreation of the entire music video, driven by 1,000 procedurally animated objects, running at 500fps.

More Projects