Spectra
This is a set of instructions on how to make accurate-looking spectra and rainbows in multi-layered fractals. It includes a number of Ultra Fractal parameters which may be copied and pasted, or you can download spectra.upr to get them all at once.
In real-world physics, one way to make a spectrum is to refract light through a transparent medium: a prism, or a raindrop, or the beveled edge of a piece of window glass, for example. White light is made up of many different wavelengths of energy, all in more or less the same place, like cards in a deck. Refraction fans out the deck, allowing you to see the individual components.
Instead of a prism, I'm going to use separate Ultra Fractal layers to spread out the light coming from the pixels in the monitor. In theory, there are an infinite number of different wavelengths, and an infinite number of different colors. However, you only need to worry about three: the primary colors. To make a full spectrum takes three layers, one for each primary.
The first thing to do is start with a basic coloring method and a simple white and black gradient. In this demonstration, I'm using a ring-shaped orbit trap on the pixel formula, but the principle can be applied to lots of different kinds of fractal colorings.
R=255, G=255, B=255 |
whiteRing {
; http://polychroma.com/fractals/
; . . . . . . . . . . .
; Tweaks OK
fractal:
title="white ring" width=400 height=400 layers=1 resolution=72
credits="Morgen Bell;10/25/2009"
layer:
caption="white" opacity=100 mergemode=screen method=multipass
transparent=yes
mapping:
center=0/0 magn=1.5
formula:
maxiter=2 percheck=off filename="jp.ufm" entry="pixeljp"
inside:
transfer=none filename="Standard.ucl" entry="Default"
outside:
transfer=sqrt solid=0 filename="Standard.ucl" entry="OrbitTraps"
p_trapshape=ring p_diameter=1 p_traporder=4.0 p_trapfreq=1.0
p_trapcolor=distance p_traptype=closest p_threshold=0.25
p_trapcenter=0/0 p_aspect=1.0 p_angle=0.0 p_solidcolor=no
gradient:
smooth=yes index=0 color=16777215 index=30 color=16777215 index=100
color=0 index=399 color=0
opacity:
smooth=no index=0 opacity=255
}
|
Once you have a basic shape you like, make two copies of the layer, so that you have a total of three, all the same. Then change the gradients so that one layer is pure red where it used to be white, one layer is green, and one layer is blue. Set all their merge modes to Screen or Addition. Now the light is being broken into its three primary components, and immediately re-combined, so the image should look exactly the same as it did when it was a single black-and-white layer.
Three layers |
threeRings {
; http://polychroma.com/fractals/
; . . . . . . . . . . .
; Tweaks OK
::0WZxGgn2tTZwOuNIQY47RKvDI/A4g9uObzWxlqetqHavviFGbzWMwOgVTe77AJrTU3U1DV9W
uB/m//ZY4TuHlqk0+46VMWyksgoKNiAwQjbIWx+pRnGF3z5sRwMMmKLtyDAGF3xQI6tzJj3J
eoNHhCBtJFFVfxjDgj9Jwa/YDfTb3mWOfX16VFvlypkhizqntzQFzHkKT6gohKwEQun8aQEp
Epcmg0oXLmmtJTQGjl2FluYQigLJOAk0kMEou+Y4kKgC+GKM5gT0U3teVvHpEklDMJ3bynol
FAUNCqfI899sejFcyJaM8SoeufqiRBhHEVBzew+SguBGX0ohHXaheKFn3BX49bJpTLRd9syu
kwnheJ1/UC+507jI+KmY040oF8/WUfFf2k+OKDxqcGhnS51jyAIyvbkg2Quz3vmTf1jaa391
8T77R4VaqwP7X5teUoNRqiK4kY6Alpy6jQMllI2IO6tUPW32dh3zj7wTyYAUpc45NuBCq4l1
lb3xy48rXNgSthMWmDxJvnIN6hkZcaYPNEOeymtP00s9D8Ty39H0Jsp8uX+2yh3t7NFaqfEw
usaO/SxeD/a76uKkOk5wbU6NK96U62u23joXK+/mPpf8ejOvRnXnOJo53ZzzSZYZBCZ/jk5v
AEObHPP=
} |
For the light to combine into lots of colors, instead of just white again, it needs to be mixed together in varying proportions. In other words, the brightest parts of each color layer need to not be directly on top of each other. One way to make that happen is to adjust the diameter of the ring trap. Here, I've made the red layer diameter larger, the blue diameter smaller, and left the green layer alone.
Diameter = 1.1 |
Diameter = 1.0 |
Diameter = 0.9 |
When combined using Screen or Addition, this makes a rainbow.
Basic Spectrum |
basicSpectrum {
; http://polychroma.com/fractals/
; . . . . . . . . . . .
; Tweaks OK
::tjX+Hgn2tTZsutNMQY4dD43BC9AITpE5UnAuE01iO0uHcm8kETpIZIpQte77JaHZjmW0hCPE
gsR+Te/3pf+B1GAZCM3veFjl0JDKK2DRtkF9oMFGHKY/UrS9ib5cWPq76T5lGYCDRxNsAGdm
xk2ZF3VP7iMgKdKKK+iL0hW2jox8QFfTdzmaOfXx6V5azdUC+clF7NjYBz5BpONJqoGMgU1D
OFKikjkPDYq3pEDjmk2DxYeiDgN6hAaTiJkkGAvXb7OaOpiBBfDZG0ZFVlNrX16CkDQ+CDwB
98NqZeMI7R5PEu2WWr2gWYgSin9ljtUCQGFmEFe9B08sn+C02oWh3vMCtkLWnFvo2vlArCCq
yRpZxhPjtAN/kDux0btI+SIxo4UrE8/lVfNsXn+eA8xiZP8PlmX3DeUEoEgEUaq6cCUu705u
gi2fbJ/0+2A+ClL8zOIdGXQo0RqnS8kYaicVacRMmml6pH9enhmyy6mLq9cg7fCyA0s5zbsd
EZxzrzffHbj1teVXAUaqwcSEHcOi1onSm2qwDUMc8mVbvrqa7n4nkv5voTgT+lPf2yl3t7VF
K3PiYX2NrbpZvCg1NN/RMtbmE/gTvSca17dKdbT9bR0LFv28J9r3PozrFdW+unPJs53pzzSz
4yCGy+PZzfhIPns8
}
|
Of course, it's possible to make rainbows like the one above using a single layer and some careful gradient manipulation. The usefulness of the three-layer technique becomes more evident when you try changing parameters other than the diameter, and using different colorings.
Aspect Ratio |
spectrumVariations {
; http://polychroma.com/fractals/
; . . . . . . . . . . .
; Tweaks OK
::8AOjygn2tzZzytNOSA47pq8OwSn2tmJKkotitnt4hkZPsXmaOMz9UwkQUIh/NAQ2W7T/2AUk
CgEQyVt2xJ1gcysB6GANb0foQHxtCahiW/Lv9NJJKuqmlvS2zKUi9NJ3TFcqi31KXl8AvUtL
/q00kdMe1Ol5PrpHYCZ+ValFMZX9edvzvmkUIYlclMf1v1JqYtJfiVX/vySfPZz7Jpp3u6tv
pS0tv3MsF0ejaromRORoHzVJd90Cu6QeGOQNM0KNdls8eqUq2h6WtLh9YPttkVm32ptDXxak
5wbfjZa5a67q3zCZSJOZxpYDTtrrMvZftirHFjHRQbl9UBrVlfghiao9982qBjjSZi803jGj
W1mnt+qNv9Nb7EoJome0Qfkr7CJpnJK2xK+ae32tJb51sWaD6q/S/69bbWlgWScIfVP/RW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2/3gL7/8fMhIbeR/YCh5xMLk43SovhFV
oZ3dOWRHIiuDMX97K2Lund8WuN/d+/5QfXxhia8oMosH/Mu0y1ne5g5vImiPgDY+1rv5a92H
dfZj7NaLROVOsJ17XnNTA+7yWrNn1pBwN2nS4UR3LHvYGzrPdCfpec0Bg3dw5LxFH94pmP9p
JPhaR88+riZTa8XFTMk2+L723rR0Xu6ubSjV39vdRtfnnH+8HTZzz438w/XtkiIu
}
|
Trap Center |
Amplitude |
Rotation |
If you look at the gradients in these example parameters, you'll see that there's an extra control point, so the band of color has some width in which its intensity doesn't vary. Removing this extra point, so as to make a completely sloped gradient, gives a somewhat different effect. The colors are paler, with not as much blending, and there are narrow visible lines of red, green, and blue.
Wide band |
Sharp slope |
Sharp gradients |
sharpGradients {
; http://polychroma.com/fractals/
; . . . . . . . . . . .
; Tweaks OK
::bWGpmjn2tTZsutNMQY4dD43BC9AITpE5UnCuEk1iO0uHch8kETpIZOSha/23TS2OGoFNLJDB
Ibk/i33d8n/QtEozg721rEisN7QVRqHooojAjF95Uh43WTuXdtUK6RbXfeepDOgUSdlgwUwN
mtBv6m6JMaCN2cSV8tA1hexdoz91K5m6mN1S5ui1rmrdulaIOXZxjuRsQEig2mPoq4GMgc1D
BDqSMRmzAm7DG1woLbjQKNPyE4TRg4BVdAZpBIGt+uF4sKSK5GGG05VVlNrX1GImAMfgBYvd
6E1iIS6eU/LVotV0adoHGYr4pY5Y7QhgBRHUFR7e09UkvBWfyawbPPCtMFfwjXU7Pyg3Akpc
U7OT4esF45nJEGz/Ni0zUWw2p1okvGqvTPaz/kgYqYiR8h806eIiKidAWwY5qndgydNHPQgM
sw1lyj7bJ8Z2YkvgQHcBSZsJupa8oY+AjV7CJMlnk65X9+gjHzy6mLq9FHP+AkioOPBfajvj
zWy51zXwl24DrXdKpNbFphQgDb8bpw6N4e2HWOZ12bqq2+F5R5pEyyHOpc1udzP6LisBvklu
kqPcG6pkWdTz/MP2NF5+MQ+OFIr+onG32U//jivV5Q+fpfmCfvShlyP8/WkzNv5xw/AwrdLH
} |
Sometimes this is an effect you want, but if you're getting pale colors and sharp lines when you don't want them, adjusting the width of the color bands in the three gradients usually fixes it.
There is a lot of fine-tuning involved in using this technique. Getting the colors just enough spread out often takes a fair amount of tweaking and fiddling. On some kinds of backgrounds, the spectra can sometimes look way too bright, or disappear entirely. Changing the merge mode from Screen to Addition or vice versa sometimes helps, or decreasing the opacity, or reducing the luminance of the colors in the gradients. With a bit of experimentation, though, you can get results that range from subtle to spectacular.
An Example
Images © 1998-2009 Morgen Bell. This gallery is a division of polychroma.com.