AI Teach Me Lava Lamps - Entropy Simulation
A web simulation inspired by Cloudflare's lava lamp wall, exploring how physical randomness can be transformed into entropy for cryptographic systems.
Technologies Used
This project was inspired by Cloudflare's lava lamp wall and the idea of using physical randomness as an entropy source for cryptographic systems.

Concept
The goal was to build a visual and interactive simulation of the process: lava lamps act as a source of physical entropy, a camera captures their state, and the resulting pixel information can be transformed into a seed for a cryptographic random number pipeline.
At the center of the project is a simple question: why are computers not enough on their own when high-quality randomness matters for encryption? The project explores that question by contrasting deterministic pseudo-random generation with entropy drawn from real physical systems.
What I Built
I built two main parts:
- A browser-based lava lamp simulation
- A frame-to-entropy pipeline that extracts data from rendered scenes
The simulation approximates lava lamp behavior with a simplified force model instead of full fluid dynamics. It includes:
- Gravity
- Drag force
- Temperature gradients, with bottom heating and top cooling
- Buoyancy force
- Boundary forces to keep blobs inside the lamp
Using Newtonian motion and Euler integration, the system updates blob acceleration, velocity, and position over time. To differentiate lamps that would otherwise behave too similarly, I introduced trigonometric oscillations based on lamp IDs.
Rendering is handled through marching cubes field composition, which is also the heaviest part of the app computationally.
Stack
- Next.js
- Three.js
- React Three Fiber
- LangGraph
- Cloudflare Workers AI
- Cloudflare D1
- Cloudflare Vectorize
- Vercel
Notes
This is a simulation and exploration project, not a secure cryptographic product. The generated keys should not be treated as production-safe. The point of the project is educational and visual: showing how chaos in the physical world can feed structured digital systems.
Tone, formulation, and text by me, refined with Claude's structural edits.