Fractal Architect 5 Help Index
Fractal Architect icon

Custom Variation Syntax


Applies to:FA 5

See: Custom Variations Useage

Custom Variations Syntax

Custom Variations are written in the OpenCL C language.
See: OpenCL 1.2 Specification

OpenCL has a large builtin math library that custom variations use.

New Variation “myCustomVariation” Example

Here is the default variation template used when you create a new custom variation (and have not renamed it yet):

px += varpar->myCustomVariation*x;

py += varpar->myCustomVariation*y;

__3D_SUPPORT_ONLY__

pz += varpar->myCustomVariation*z;

Note that renaming the variation name in the Custom Variation panel will also simultaneously rename the variation name in the variation’s source code.

The template is in fact the source code for the simplest variation type of all, linear.

All linear does is multiply its variation weight to the input point values; then adds the result to the output point values.

The first line uses the input point’s x coordinate. __x,

multiplies it by the variation weight, varpar->myCustomVariation,

and adds the product to the output point’s x coordinate, __px.

The 3D_SUPPORT_ONLY macro marks the beginning of a block of source text that is only used in 3D renders. All variations that support both 2D and 3D renders will have this block at the end of the source code. 2D only and 3D only variations do not have this.

Pre Defined Kernel Variables

These are the pre-defined variables used by the rendering kernel.

Variable Apophysis Description
__x pFTx Input point’s x coordinate.
__y pFTy Input point’s y coordinate.
__z pFTz Input point’s z coordinate.
__px pFPx Output point’s x coordinate.
__py pFPy Output point’s y coordinate.
__pz pFPz Output point’s z coordinate.
__pal TC Output palette value (used by direct coloring variations).
__r2 Pre-calculated radius squared = __x * __x + __y * __y
__r Pre-calculated radius = sqrt(__r2)
__phi Pre-calculated phi angle = atan2(__x, __y)
__theta Pre-calculated theta angle = atan2(__y, __x)