I decided to see if application of Tglad's location restricted based rendering (which I suppose originally should be credited to Barnsley for example with the Barnsley types in Fractint) could be used to optimise the rendering of more general IFS.

So I decided to start with the classic Heighway Dragon.

Here is a render showing the Heighway Dragon coloured to separate the areas belonging to each of the primary transforms (the last if using convergent rendering, the first if using divergent rendering):

Clearly we can't really use a simple location method to separate the areas for each of the transforms since the boundary between them is itself fractal in nature, however we could split the plane into 3 sections, an area to the left (transform 2 only), a central area (both transforms possible) and an area to the right (transform 1 only).

In this case we could say that transform 1 is needed if x>-0.34 and transform 2 is needed if x<0.167.

Rendering on a depth by depth basis rather than traversing the IFS tree we can use this to control which transforms are performed on each iteration and using the above figures we get this result for a bailout radius of 16:

Clearly we are getting hard breaks in the distance estimates, this is because we have only decided which transforms to use on locations inside the fractal but our colouring is actually outside.

Here is a view of the fractal with both inside and outside coloured based on areas belonging to the primary transforms:

Clearly splitting the plane in the same way means the central area that requires both transforms to be performed is much larger.

Re-rendering using the new locations corrects the DE:

In case you're wondering why use such a large bailout value, here's the problem if you use the smallest possible bailout:

As you can see the distance estimation is split at the iteration boundaries, this is because that although our bailout radius (here 1.36) is large enough to contain the whole fractal so inside/outside is rendered correctly the magnitude is insufficient for correct distance estimation because the second level bailout spheres overlap the primary bailout sphere and a larger bailout is required to reduce/prevent this problem.

I then thought that maybe doing a limited resolution pre-render to a square of side 2*bailout radius storing the information about which point belongs to which transform may be useful (such that if pixel 1 belongs to transform 1 first then all pixels in the associated 3*3 pixels are flagged as belonging to transform 1 and the same for transform 2 i.e. so boundary pixels could use both transforms).

This worked very well and is in fact by far the fastest rendering method.

Here is a test UPR which includes my test formula (copy the whole lot and paste into an open fractal window in UF:

IFStransforms {

::HYFDOjn2tX5WrtNMUA43Dk/DC/02DNRXskt3QPMIrwgVGsu3LK2KJaV+CSydN7X/kvlIoZQX

pdbsFwGkOSnrSf6sxIydC9bmPDAcKnWyj+wlX7MiK7maTpNC8NVhbHnFDB7kqt7c84UIQL2L

NWecna5GZhyZ5RrE3pK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EZTeSW

F1xwlMmrkBWKnHUx85LYn86oDjBzh7A2pcqO2jzRdOONtgNCnInfzVyr3elcau0csgh3NPto

gWloKLtIA8H4+lwr7F1/NvNUdydHsk4+xxhhofTJ/C4JQXaIlFwj5VBBqC3VfQihnymi45GU

PTT3IGyCaCyq6G0jUmmLUXvDSdQ9mYNHl2AA9+fuWktm65yfQEvv1Lkyyf3S9r9KFk1uSAUk

jXVoWwr2tS23j3yXNzsNu7QvcHLex81WNV5u6JwTR+yBgnZ3EwWKRLQoBIIW4gfsoxPJWwh/

WbEsbjKebIwV/D+uxgkY2xgGnaPwBIFXll4r+8WDQyFKMR33N96JO8V/mUzDP46DDi6jv8bP

m6DDi7fx7+qq8w14dXdo5dD+CXdA/c1B10d8/jrOgfkrOY/6HOGcEtTqRzhY/qkk2Wn7QN5m

GypmCLZ46ItlLb9ImDHJ52Jbt2kkDrxTpOXKR7QxJy5R9AK3xSbOq2hESeUtDxF+RreHXdfu

tDx0yB1OkvhgwrZaXwTQWLRvWQlX7SrCF9A2cAHPOVowuqQh9WhC7pCVdzC22+/uqhMxyG/M

7PgHqdM9H0I5R1fwXy8Ff9HISX2f/BPnu8fr0F7LMP4bHxPW3OK+i6O3INTCWUcZZ4pLHpw/

Vd2mYkbxH7xDJ36KPpVNa6ATrA9cFzSbtnOrPF025X+2owzaosplClfzfWb8fGbNbb7zHvzd

C6kHPHEMomv3MEIliDgfkuqgvQNpGagJBdSdG0z1P9jf/PfCboeZzoT3VZyTLSrSLR8zaR0w

KaQzJfkssuPY8d2Cf8LVpzWOeeV5Jcma2LRwFEIwUkUja/6/U5vt7PbZYl2fA8rMDOJ/iG6s

Z3oapUkmJuaLhWdXJ/4+v7C3CI/BlJ5uFqdwO2m5+XcmY+d2CMyjA+0fsF792zG4TCD+/bg9

efMN

}

Here is a UPR to compare the different rendering methods (needs the formula from the UPR above so paste that lot into UF first):

IFSde {

::TPxSxhn2tv5WPyNuZa47Ng/PUovKZD626jn5GoLyiJZxCkZTQOc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UpR

oCP6AEe2BIdFUpRoq44DQFnfASXDV6Coq4IEQ60Zrk9XB83+L/9b/l/+/p/l/+/A6rbSvC==

}

Timings on my machine for the individual test layers in the above:

Original traversal of the entire tree: 6 mins 36 secs

Depth by depth complete: 4 mins 59 secs

Depth by depth Location restricted: 1 min 40 secs

Depth by depth Pre-render restricted: 25 secs

The key thing is obviously to reduce the area that requires more than one transform/path on each iteration - this manifests itself in my test formula as the array size required to avoid errors rendering the "inside" - e.g. try reducing the array sizes on the depth by depth layers and you'll see the problem.

Obviously the low-resolution pre-rendered map method is best but it does suffer from problems e.g. extremely thin/small transform areas may get missed and there would definitely be memory issues for applying it in 3D - here a 256*256 pixel pre-render is no problem but 256*256*256 is starting to get a little large

Edit: I should add that the depth-by-depth methods are by no means fully optimised - for instance changing the array storage to a linked list method sorted by magnitude would probably help a lot