![]() Long trajectories inside the frame are much better than short trajectories or trajectories completely off-screen. Trajectories are completely determined by their starting point, and the usefulness of a trajectory is determined by how many histogram bins it touches before escaping. However, if we're a bit smarter about how we sample the starting points of the trajectories, we can mitigate this problem. This "spray and pray" approach works reasonably well for zoomed out images, but zoom-ins and transformations are very difficult to render in a reasonable time frame, since many trajectories land outside the frame and their computation is wasted. The main problem is that we cannot directly compute the value of the Buddhabrot at a pixel, but have to sample many random trajectories and hope that they pass through the pixels we care about. Rendering the Buddhabrot efficiently poses a bit of a challenge. Rotating between the Buddhabrot and the Mandelbrot fractal Importance sampling Interestingly, the Buddhabrot contains the entirety of the Mandelbrot, and with the right projections we can rotate back and forth between the two. ![]() How to map trajectories to pixels is a matter of projection, and Melinda Green (the discoverer of the Buddhabrot) has more resources on the topic. If we keep doing this, we will eventually obtain an image where bright pixels show regions that are visited often by escape trajectories, and dark pixels to those visited rarely. To obtain a Buddhabrot, we simply build an image representing a histogram of these trajectories: We start with a black image, and whenever a trajectory passes through a pixel, we increment it by one. If we do this many times, we will end up with a large list of points not in the Mandelbrot set and their trajectories on their way to infinity. The transformed versions of the point correspond to its "trajectory" through space as it escapes to infinity. The major difference, however, is which points are kept: If a point does not escape, it is thrown away but if it does escape, the point and all of its transformed versions are stored. The Buddhabrot uses the same iteration rules as the Mandelbrot: Points are sampled on the complex plane, repeatedly transformed using a simple function, and filtered based on whether they escape to infinity or not. This emergent complexity seems to be a funky property of the complex plane, and many other fractals have been made using similarly simple rules over the complex numbers. The Mandelbrot fractal is fascinating, because it generates a point set of mind-boggling complexity from a few very simple rules. The points that do not escape become part of the set. The Wikipedia pages on the Mandelbrot and the Buddhabrot are a better resource, but briefly, the Mandelbrot set works by picking points on the complex plane, repeatedly transforming them with a simple formula and checking whether the points eventually escape outwards to infinity or not. The Buddhabrot is a curious fractal that produces wonderful images of cloudy and colorful nebulas, and is closely related to the Mandelbrot set. I am not convinced it was worth it, but I'm happy to finally put the project to rest :) A Buddhawhat? My poor GTX480 also ended up dying a fiery death at the hands of the fractal, and I had to borrow a computer to finish the job. Programming and camera setup took the better of two months, and rendering the final animation took more than 10 days. A lot of time went into careful importance sampling code and denoising methods to keep render costs in check. I was also set on rendering at 4K resolution, and render times shot through the roof. ![]() However, feature creep set in, and this ended up being a lot more complex to do than originally intended - a single camera pan was not interesting enough, and I started writing a lot of throw-away tools to setup 4D camera shots synchronized to music. The Buddhabrot lives in a 4D space, and rotating through different projections onto a 2D screen does better justice to its intricate shapes. Instead of rendering a single large image, I thought an animation sequence would be more interesting to look at. ![]() However, I don't like leaving things unfinished, and for the past few months I have been writing a modern GPU implementation of a Buddhabrot renderer to see where I could take it. I did not know a lot about writing fast code back then, and unsurprisingly that project was unsuccessful. Recently I have been digging through some old projects and rediscovered an old high school project of mine that attempted to render very large images of the Buddhabrot fractal. Rendering a Buddhabrot at 4K and Other Bad Ideas
0 Comments
Leave a Reply. |