Tiny Mandelbrot renderer which allows you to pan and zoom around the Mandelbrot set in real-time. It renders at a low resolution and then slowly refines the image the longer you stay in the same place/zoom.
Controls:
- Pan around with the directional buttons
- Zoom in with button 4 (Z on kbd)
- Zoom out with button 5 (X on kbd)
- Toggle between two shading modes with second player's button 4 (LShift on kbd)
- Cycle through five different color palettes with second player's button 5 (A on kbd)
My first PICO-8 Cart! Now updated with color schemes and bugfixes! Maybe someday I'll add Julia sets.
Source is on Github at https://github.com/mbh95/mandelbrot-pico-8
I really like it, but things get weird when you zoom in far enough. It won't let you move or zoom back out, and the screen goes all one color. It doesn't seem like you can zoom infinitely, which to me is the most fun part of fractals.
I think we're seeing the floating point limitations in play here. Otherwise there'd be a lot more interesting things to see as you zoom in. But good job.
@nonymousFog, you're seeing a fractal that is generated by a simple equation. The edge of this fractal is defined by when the complex number at that point, when put through a simple recursive equation, tends towards zero or infinity. Interestingly enough this edge, if you zoom in on it, doing math with smaller and smaller decimal values, you quickly realize that the edge never straightens out and contains within itself, self similar shapes, like the one you see at the beginning. It's a mathematical landscape of infinite exploration and it's kinda mind blowing.
The iterative detail effect looks great and makes the whole thing feel very responsive.
I think it may be number of iterations that’s causing detail to fade out early, not decimal accuracy.
Here’s a stab I made a while back: https://www.lexaloffle.com/bbs/?tid=29053
This makes me want to dust it off and see if I can speed things up and make a better/actual interactive interface.
We need more Mandelbrots!
The lack of detail is caused by the low iteration count I hard-coded for now (15) to keep the renderer responsive, but the bug where if you zoom in far enough zooming and panning stop working is indeed an artifact of the floating point limitation.
Updated this cart with a few new features and bugfixes!
New Features
- Five color schemes!
- Two different shading modes
- Dynamic level-of-detail (improves performance when zooming/panning as well as gives more detail when still)
- Dynamic per-frame workload (balances performance when there are a lot of long escape-time points on the screen)
Fixes
- Fixed floating point zoom getting stuck at extreme values
- Fixed floating point overflow causing noise when zoomed really far out
- Fixed issue where rendered rectangles were one pixel too large on each side.
It starts to lag when you zoom in to the parts with a lot of colors, but I like it.
Hi mbh95,
One simple speed up is that variables defined with the “local” prefix are a lot faster than the default global ones. This could accelerate your core Mandelbrot iteration function.
[Please log in to post a comment]