**Custom depiction modes.** By “long tap” on any of the depiction modes in the menu you may modify it. In the appearing dialog you can change the code of the shader and also add an auxiliary texture from your photo gallery. The shader has to be written in the Metal Shading Language which is based on C. For example the “iteration” shader looks as follows:

float4 color(constant Params ¶ms, Data input) { float3 c; if(input.iter>=0) c = pal(params, float(input.iter)+0.5, params.brightnessfinite); else c = pal(params, float(-input.iter)+0.5, params.brightnessinfinite); return float4(c, 1.0); }

Here is the code for the function “pal”:

float3 pal(constant Params ¶ms, float iter, float brightness) { float3 c = float3(0,0,0); for(int i=0;i<params.ncolor;i++) { float amplitude = 0.5*(1.0+sin(iter*params.color[i].frequency+params.color[i].initial)); c += params.color[i].c*amplitude; } c*=brightness; float m = max3(c.r,c.g,c.b); if(m>1.0)c /= m; return c; }

...and the specifications of the relevant structures:

typedef struct { float3 c; float frequency; float initial; } UniformsColor; typedef struct { int ncolor; UniformsColor color[NCOLOR]; float brightnessfinite; float brightnessinfinite; float param[NPARAM]; float time; int auxwidth; int auxheight; } Params;

The number of custom parameters (Params.param[]) may be specified in the dialog. They can later be changed tapping on the “brush” icon in the lower right corner.

In the following structure members are only available and calculated if the corresponding slider is on. Keep in mind that any additional value may slow down the calculation.

typedef struct { float dist; // The distance to the Mandelbrot set in pixels (For Julia fractals this works momentarily only in the finite area) float dist2; // The distance to the next iteration level in pixels float2 value; // The (complex) value of the last iteration (where its absolute value is <2; or a point in the limit cycle if the iteration is infinite) int32_t iter; // The iteration number (a negative value means limit cycle of the corresponding length) float smoothiter; // The iteration number smoothed out float2 derivative; // The derivative of the last iteration float2 coord; // The coordinate (in the complex plane) of the current fragment float2 screencoord;// The screencoordinate of the current fragment float pixelsize; // The size in pixels of the current fragment texture2d<half> auxtexture; // The auxiliary texture if any has been chosen } Data;

The values “dist”, “dist2”, and “smoothiter” are actually functions of “iter”, “value”, and “derivative” but have been added to keep the necessary memory access from the GPU low.