--- slug: 2025/03/playing-with-fire-camera title: "Playing with fire: The camera" date: 2025-03-07 12:00:00 authors: [bspeice] tags: [] --- Something that bugged me while writing the first three articles on fractal flames were the constraints on output images. At the time, I had worked out how to render fractal flames by studying the source code of [Apophysis](https://sourceforge.net/projects/apophysis/) and [flam3](https://github.com/scottdraves/flam3). That was just enough to define a basic camera for displaying in a browser. Having spent more time with fractal flames and computer graphics, it's time to implement some missing features. ## Restrictions To review, the restrictions we've had so far: > ...we need to convert from fractal flame coordinates to pixel coordinates. > To simplify things, we'll assume that we're _plotting a square image_ with range $[0,1]$ for both x and y > > -- [The fractal flame algorithm](/2024/11/playing-with-fire) There are a couple problems here: First, the assumption that fractals get displayed in a square image. Ignoring aspect ratios simplifies the render process, but we usually don't want square images. As a workaround, you could render a large square image and crop it to fit an aspect ratio, but it's better to render the desired image size to start with. Second, the assumption that fractals use the range $[0, 1]$. My statement above is an over-simplification; for Sierpinski's Gasket, the solution set is indeed defined on $[0, 1]$, but all other images in the series use a display range of $[-2, 2]$. Finally, the camera controls available in Apophysis/[`flam3`](https://github.com/scottdraves/flam3/wiki/XML-File-Format) have a number of settings that were simply not implemented so far: