|
|
Release 4.0 |
 |
Quaternion - Coloring Formulas
The third type of formula supported by ChaosPro are coloring formulas. Their purpose is to calculate the final color. The formula can
either specify the color directly or indirectly:
- Directly, by setting the predefined variable pixelcolor to the desired color. A formula using this variable is called a "Direct Coloring Formula", because the palette and the global settings in the coloring tab do not have any influence on the fractal, i.e. these parameters are not used any more (unless you use the gradient function).
- Indirectly, by setting the predefined variable index to a real value, which then acts as an index into the current palette.
You can specify additional mapping parameters in the inside or outside tab of the fractal itself. Basically you could implement these mappings through
the use of parameters in your formula, but this way some basic mappings are always available.
If in the outside tab the parameter Mapping is set to Linear, Speed and Accel are set to 1, then the mapping is 1:1, and that means:
-
If the index returned from the coloring formula is 0, then the corresponding pixel gets colored with the very first color of the palette.
-
If the index returned from the coloring formula is 0.5, then the corresponding pixel gets colored with the color in the middle of the palette.
-
If the index returned from the coloring formula is 1, then the corresponding pixel gets colored with the last color of the palette.
So if the coloring parameters in the inside or outside tab are set to their standard values, then the range from 0 to 1 maps exactly to the whole palette.
Please keep in mind that the palette defines only a path through the color space: You can specify only about 230 colors using the palette editor, but these few colors simply are keyframes in the color space and get interpolated. So index=0.1332 and index=0.1333 will map to (slightly) different colors!
Back to the coloring formulas: Such a formula can contain the following functions:
The init_once, the init and the loop function are optional. You need not specify them. But perhaps you want to color a pixel and the information
at the end of the iteration cycle is not sufficient. Then you can use init and loop functions.
Notes
In order to tell ChaosPro that this formula is ment for fractal type Quaternion (and thus the proper predefined variables are defined), you need to specify the keyword QUATERNION in brackets after the formula identifier.
This tells ChaosPro that pixel and z are quaternion variables (instead of complex variables) and that the other predefined variables for this fractal type are defined.
CP_None(QUATERNION)
{
void final(void)
{
index=abs(sin((real(pixel))+cos(imag(pixel))));
}
void description(void)
{
this.title = "None";
}
}
|