David Makin's Fractal Blog


Recently I was contacted by Garth Thornton (author of Xenodream) pointing out that some documentation is required regarding transferring Xenodream fractals to my 3D IFS formula for Ultrafractal. In fact the only documentation on the 3D IFS formula at the moment is in the form of the hints on the parameters and the brief information section. Consequently I decided to write this guide to the 3D IFS formula giving a brief description of how it works and some help on getting the best results.

How it works


Unlike Xenodream and other "normal" fractal programs for rendering 2D or 3D IFS or flame fractals the 3D IFS formula does not use either the chaos game or deterministic methods to render the fractal. I have a particular liking for zooming into details and these standard convergent methods have the drawback that zooming-in is not optimum and deep zooming is effectively not possible. This is basically because both methods require that the entire fractal is calculated even when you only want to render a small portion of it. The 3D IFS formula instead uses the escape-time method for rendering the IFS. In this case the inverse transformations are used i.e. the transformations need to be expanding ones rather than contractive however in the formula you specify the contractive transforms as normal, the formula inverts them internally. The formula is essentially a ray-tracing formula that intersects the ray for each pixel with the fractal attractor.

It does this by having a bounding sphere (that must contain the whole fractal for correct rendering) that it intersects the rays with. This works by first intersecting the standard viewing ray with the bounding sphere and if intersection is found then we proceed further into the IFS tree by transforming the viewing ray by the transformations for the fractal and again test for intersection with the bounding sphere. This process is continued in such a way that the "whole" IFS tree is tested down to a limit depth (controlled by the user max. depth and/or min. scale parameters) and the algorithm finds the closest point of intersection between the ray and the fractal. This means that the specified bounding sphere is one of the most important factors in efficient rendering. If the bounding sphere does not contain the whole fractal then many holes will appear in the fractal where sections are missed. If the bounding sphere is larger than necessary to contain the whole fractal then render times will be slower than necessary and individual "points" on the fractal will be larger than they really should be. There are two parameters controlling the bounding sphere, the centre and the bailout radius.

In the formula using the default settings the bounding sphere centre is calculated automatically but you may override this and explicitly specify the centre coordinates if you wish to do so. Also by default the formula attempts to calculate the bounding sphere bailout radius and in this case you can scale the automatic value or disable the automatic calculation and specify the bailout radius explicitly. When specifying the bounding sphere centre and bailout radius yourself for optimum performance the settings chosen should give the smallest possible sphere that contains the whole fractal.

The escape-time method does have the drawback that the usual non-affine modifications used in flame fractals or in Xenodream cannot be applied since they are generally not invertible and the escape-time method requires the inverted forms. It is possible to write an escape-time formula that allows non-affine modifications but they wouldn't match what you get using the convergent methods and it's not feasible using the algorithm in the 3D IFS formula since repeatedly transforming a viewing ray by a non-affine transform and then performing intersection with a sphere is not feasible - a possible way to allow non-affine transforms would be to use a distance estimation method instead but (as I already discovered) that method is decidedly slower in comparison.

The parameters


1. Method


View

Here you can choose to either view the fractal or the source transformations. If you choose to view the source transformations then you need to set the "Pixel width" and "Pixel height" parameters to the size of the display window. When viewing the source transformations an untransformed cube is shown along with the transformed version of the cube for each active Transformation. You should view the Transformations using mmf.ucl-'MMF 3D colouring' as the inside colouring: palette index 1 and 6 are used for the untransformed cube, 10 and 15 for Transformation 1, 20 and 25 for Transformation 2, through to 310 and 315 for Transformation 31 (all assuming that the Color Density is set to 1 and the Transfer Function is Linear).

Reverse Inside/Outside

Normally points "on" the fractal are rendered as "inside" but you can use this switch to make them "outside" instead thus allowing you to use outside-only UF colourings if you wish to do so (though few such will be appropriate, if any).

Pixel width

This parameter specifies the pixel width of the window used to display the transformations, when not viewing the transformations you should set it to 1, especially before doing a disk render. When viewing transformations it should either be set to the width of the fractal window, or to the width of the preview window if you wish to modify your transformations using UF's explore feature.

Pixel height

Specifies the pixel height of the window used to display the transformations, when not viewing the transformations you should set it to 1, especially before doing a disk render. When viewing transformations it should either be set to the height of the fractal window, or to the height of the preview window if you wish to modify your transformations using UF's explore feature.

Auto-scale detail

Setting this parameter instructs the formula to automatically calculate various "correct" values for rendering the fractal based on the rendering magnification and resolution. It controls the value used based on "Min. scale", "Light scan distance" and "Joined threshold". It should be noted that auto-adjustment of the "Min. scale" parameter means that finer detail will show on a large disk render as compared to rendering the fractal in a normal viewing window so if you wish the large render to appear exactly as the smaller version you should then disable this option (in which case it's best to enable "auto" for the "Light scan distance" and the "Joined threshold" individually).

Test Centre

Here you can choose "Auto" or "Specified coord.". Choosing "Auto" means the formula attempts to calculate the best centre coordinates for the bounding sphere which is normally the best option. If you choose "Specified coord." then you need to specify the x, y and z position for the centre of the bounding sphere. Note that for fractals where any of the transformations have any scales greater than around 95% you will need to specify the centre yourself.

Centre x and y (Test Centre=Specified coord.)

The x and y coordinates of the centre of the bounding sphere.

Centre z (Test Centre=Specified coord.)

The z coordinate of the centre of the bounding sphere.

Min. scale

This parameter allows you to control the detail level used in rendering the fractal. The smaller the value the finer the detail. A value of 100% normally means that the finest resolution is around 1 pixel which is the best setting for rendering. Using smaller values will increase the detail level and increase the render time, using larger values reduces the detail and the render time. Note that in combination with the "Max. depth" parameter the Min. scale controls how far down the IFS tree the formula goes when rendering, if the "Max. depth" parameter is too low then reducing the Min. scale will have no effect. If you wish to control the detail using Min. scale only then it's best to set "Max. depth" to a larger value (e.g. at least 100).

Auto-adjust Min. scale

This parameter is provided in the unlikely event that you should wish to make the Min. scale automatically adjust according to magnification and resolution without auto adjustment of either the "Light scan distance" or the "Joined threshold". In most cases it should be left unchecked and the overall "Auto-scale detail" used instead.

Max. depth

This parameter controls how far down the IFS tree to go when rendering in combination with the "Min. scale" parameter. The larger the value the further down the tree the formula may go and the more detail is shown. If you wish to control the depth and hence the detail level using only the "Max. depth" then you should set "Min. scale" to zero. Note that "Max. depth" is never auto-adjusted according to magnification or resolution.

Min. depth

This parameter is only really useful when controlling the depth/detail level using the "Min. scale" parameter. In some cases where one or more transformations have extremely small scale factors you may need to increase this value from the default of zero in order for the fractal to render properly. So far I haven't found any reason to change it from zero.

Calculate bailout

When enabled the formula calculates the bailout radius to be used. The value found is only approximate in many cases. If the transformations for the fractal include no rotation (other than multiples of 90 degrees) and no skewing (other than multiples of 180 degrees) then the auto-calculated Test Centre and bailout radius shoud work fine with the "Bailout(adjust)" set to the default of one, e.g. for the Sierpinski tetrahedron, Menger Sponge or the usual Sierpinski-style buildings/architectural fractals etc. If arbitrary rotations or skewing are used in any of the transformations then if "Calculate bailout" is enabled you may need to increase the "Bailout(adjust)" parameter from the default of one. If any scale factors in the transformations are greater than around 95% then you will need to disable "Calculate bailout" and specify the bailout radius directly (using "Bailout(adjust)").

Bailout(adjust)

If "Calculate bailout" is enabled then this parameter allows you to scale the calculated bailout radius for the bounding sphere which may be necessary when some transformations have rotations or skews. If "Calculate bailout" is disabled then this parameter allows you to specify the bailout radius explicitly which will be necessary when any transformations have any scales greater than around 95% (in which cases you will also have to specify the centre for the bounding sphere yourself).

'Flat' Rendering

This parameter allows an alternative to the default method of checking for bailout. For most renders it makes little difference and is best left unchecked but if you disable all auto-adjustment of "Min. scale" and zoom into a fractal you'll see a definite difference between "normal" rendering and "flat" rendering.

Light scan distance

When performing extra ray-tracing of adjacent pixels to get the lighting normals this parameter controls how much of the adjacent ray-segments should be checked for intersection with the fractal. Smaller values will reduce render times but increase the possibility of errors, normally the default works fine.

Auto-adjust Light scan distance

This parameter should normally be left enabled, though if "Auto-scale detail" is enabled the value is irrelevant. When either "Auto-scale detail" or this parameter is enabled the Light scan distance is automatically adjusted according to magnification and resolution. So far I have found no reason to have automatic scaling of the Light scan distance disabled.

User Priorities

This parameter allows you to specify the priorities of the different transformations i.e. the order in which they appear in the IFS tree. The order can significantly affect rendering speed and usually this parameter is best left disabled in which case the formula works out the best order itself based on the viewpoint and the transform locations.

2. Viewing control


Transformation View (View=Transformations)

Here you can choose "All" or "Selected". 'All' always shows all active Transformations, 'Selected' shows either all the Transformations or just one (if it is active) as set by the 'Show Tranforms' parameter. When showing just one then the view is centred on that transform i.e. the translation is ignored for viewing purposes. An original untransformed cube is always shown.

X/Y Rotation (View=Transformations)

Allows you to rotate the transformation view.

Target x/y coords

Allows you to specify the x and y coordinates as a target for the camera. This coordinate is the one the camera is rotated around and is also normally the coordinate that the camera points towards. Typically set to the centre of the fractal object.

Target z coord

Allows you to specify the z coordinate as a target for the camera. This coordinate is the one the camera is rotated around and is also normally the coordinate that the camera points towards. Typically set to the centre of the fractal object.

Camera distance

This value specifies the distance of the camera's viewing plane from the target. In perspective rendering mode this in part controls the size of the object.

Camera Rot

Allows you to specify the rotation of the camera around the target in degrees. The real part controls the direction and the imaginary part controls the elevation.

Camera Dir

Using this parameter you can rotate the camera in degrees so it doesn't point directly at the target. The values are offsets from the default direction of the camera (towards the target). The real part controls the direction and the imaginary part the elevation.

Projection Method

Here you can choose to have the object rendered in parallel or perspective rendering. Parallel rendering has no perspective i.e. objects do not get smaller with distance from the camera/viewpoint. Parallel rendering can be useful for setting the target coordinates because it makes it easier to find the coordinate values for a particular point on your fractal e.g. by viewing at rotation (0,0) then at (0,90) or (90,0).

Image plane distance (Projection method=Perspective)

This parameter specifies the distance from the viewpoint to the image plane. The smaller the value used the greater the perspective. Using larger values is good for viewing fractals as if they are small objects say around 1 foot in size, using smaller values is good for viewing fractals as if they are large buildings for instance, generally using smaller values means you'll also need to increase the magnification. If you find yourself using very large values (e.g. greater than 30) then it's probably best to switch to parallel rendering.

Front clip (Projection method=Perpective)

The front clipping distance. The front clipping plane is set to this distance from the image plane, anything closer to the image plane than this is clipped. You may set the distance to less than zero (i.e. behind the image plane) if you wish.

Back clip

Specifies the distance for back clipping. When using perspective projection the back clipping plane is set to this distance beyond the front clipping plane. When using parallel projection the back clipping plane is set to this distance from the image plane.

3. Advanced clipping


Here you can specify extra clipping options. You can specify one, two or three mutually perpendicular pairs of clipping planes, front/back, left/right and/or top/bottom and/or you can specify a clipping sphere. There are a number of parameters to control the position/orientation of these clipping objects, all the necessary information is in the parameter hints.

4. Colouring/Lighting


Colouring

If you choose "UF colouring" then you can use any UF colouring at all, "Lighting", "Position/Distance" and "Genetics" require '3D Colouring' from 'mmf.ucl' and the mixed lighting and colouring modes need '3D colouring direct' from mmf4.ucl. Note that you can't mix general UF colouring and lighting without using separate layers but the mixed colouring and lighting options give you the option of producing a coloured and lit fractal in one layer. In fact even then it's actually best to work with two layers at first - one using "Lighting" and one using either "Position/Distance" or "Genetics" because then you can easily modify the colours of the colouring layer without the fractal being regenerated and finally combine the layers into a single layer using the appropriate colouring/lighting combination ready for final rendering - rendering a single combined layer will be faster than rendering two separate layers. Note that when using normal "Lighting" then "Repeat Gradient" should be disabled and maximum iterations is best set to 1. When using the distance/location or genetics colourings then "Repeat Gradient" should normally be enabled and maximum iterations set to 1. When using "UF colouring" use maximum iterations to control the "business" of the colouring. When using the mixed colouring and lighting layers in normal lighting mode maximum iterations should be set to 2 and when in advanced lighting mode maximum iterations should be set to 4.

Lighting method

Here you can choose from "Z-buffer" or "Bounding normals". Bounding normals may produce some interesting results but is generally not recommended for accurate lighting of the fractals.

For the rest of the colouring/lighting parameters please see the hints on the parameters as these provide the necessary information depending on your "Colouring" selection. Note that when using a combined colouring and lighting layer then "Lighting Version" in the 3D IFS formula must match "Lighting Version" in mmf4.ufm-3D Colouring Direct colouring formula. If you appear to get black unlit areas on acute angled sufaces then you may need to increase the "Joined Threshold".

5. Fractal Calculation


Apply Overall Transformation

This option allows you to specify a special transform that will deform the fractal by an affine transform without the fractal losing it's essential nature. The associated parameters allow you to specify an affine transformation to be applied to the fractal.

Apply Deformation Transformation

This option allows you to deform your fractal to produce an entirely different fractal. Can be particularly useful for animation. The associated parameters allow you to specify affine transformation values used to deform the normal transformations of the fractal.

6. Individual Transformations


User scales?

If you set this then you will need to specify an associated scale factor with each active transform. This can be useful when a fractal has some very long/thin/stretched transformations but generally is best left disabled.

Xenodream mode

For fractals exported from Xenodream. Best left disabled unless the fractal has been exported from Xenodream or you are doing so "by hand".

Use depth restrictions

When enabled you can set flags to disable transformations at given depths in the IFS tree. For example to make one entire corner of the Menger Sponge disappear but so the sub-sponges stay whole.

Show Transforms

Simply for ease of user-input you can choose to have all the transforms visible in the parameter section or select just one to view/edit. Also controls display when viewing the transformations.

7. The Transformations (==Xenodream Holons)


Priority (User Priorities enabled)

The priority of the transform controlling its position in the IFS tree and hence the rendering speed.

RIFS code

The RIFS code is made up of binary flags, for each set bit this Transformation will not be followed by the one represented by that bit. Bit 0 (ie. 1) represents Transformation 1, bit 1 (ie. 2) represents Transformation 2, bit 2 (ie. 4) represents Transformation 3, bit 3 (ie. 8) represents Transformation 4 etc. For example if you didn't want this Transformation followed by Transformations 2, 6, 9 or 16 then you would set the RIFS code to 2+32+256+32768 ie. 33058. Note that here the "followed by" means as if using the standard contractive method for generating IFS.

Depth Masks

The depth restriction masks for this transform. For instance the first mask will be for depths 0 to 30. Add a binary value for each depth you wish to disable the transform on. +1 masks depth 0, +2 masks depth 1, +4 masks depth 2, +8 masks depth 3, up to +1073741824 which masks depth 30.

The Transformation main parameters - (initial Translation), Scale, Rotation, Skew, (Custom Transform), Translation

These are the same as the equivalents for holons in Xenodream except the translation values should be 100* smaller than the values used in XD. Also when not in Xenodream mode you have priorities on each of these transforms which control the order in which they are applied. Normally it's best just to ignore the priorities but specialists in IFS may find the option to control the order of application very useful. The initial Translation and Custom Transform are optional. Note that the initial Translation is always applied first and the Translation always applied last.

That's all for now, I hope to do some hints and tips for the 3D IFS formula soon.


Browse Galleries
Fractal Blog Archive
Art Services

Art Services

Art Services

Valid HTML 4.01 TransitionalValid CSS!