• April 19, 2021, 05:10:42 PM

### Author Topic:  Algorithm for Rendering Slope in a Fractal  (Read 3847 times)

0 Members and 1 Guest are viewing this topic.

#### LionHeart

• Posts: 164
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #120 on: April 08, 2020, 06:10:39 AM »
Wow Gerrit,

That's one nice image. Where does one find it in the set?
Paul the LionHeart

#### mrrudewords

• Fractal Frogurt
• Posts: 473
• Dat Mandel!
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #121 on: April 10, 2020, 01:20:53 AM »
Just to throw my tuppence in. I do this differently in Infinity Fractal. I suppose it might be considered less elegant, but it works for all formulas and colouring methods.

Starting with a colouring method such as Smooth (log), Smooth (exp) or Triangle Inequality Average - for example:
Each of these methods results in a double representing a location in the palette (where the number is greater than the length of the palette it is wrapped around)
So for slope, I consider this number to represent the pixel's/orbit's height.
Now, when colouring the pixel, I check the surrounding (eight) pixels' heights to calculate how much brighter or darker this pixel should be.

Eg:

c = pix.ColourIndex;
l = c; // lowest index
h = c; // highest index
a = 0; // colour addition
m = 64; // multiplier

for each surrounding pixel (sp)
{
sc = sp.ColourIndex;
if (sc < l) l = sc;
if (sc > h) h = sc;

yy = -1 / 0 / 1 (sp position relative to p)
xx = -1 / 0 / 1 (sp position relative to p)

hd = c - pc;
if (hd > 0)
{
if (yy > 0)
a -= hd;
else
a += hd;
if (xx > 0)
a -= hd;
else
a += hd;
}

each element of the colour (R, G and B) are then added to by:
a * m / (h - l)
}
Z = Z2 + C (obvs)

#### gerson

• Fractal Frankfurter
• Posts: 572
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #122 on: April 10, 2020, 02:23:51 AM »
@mrrudewords is it working on infinity.1.0.20?

#### gerrit

• 3f
• Posts: 2402
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #123 on: April 10, 2020, 02:45:05 AM »
Wow Gerrit,

That's one nice image. Where does one find it in the set?
Referring to https://fractalforums.org/fractal-mathematics-and-new-theories/28/mandelbrot-foam-math/1665/msg8427#msg8427, $$q=0.35i$$, location -0.0523992616496 + i*0.185100952071,
magnification 308.

#### LionHeart

• Posts: 164
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #124 on: April 10, 2020, 01:30:39 PM »
Hi mrrudewords,

Can you show us some images as an example of how it looks. Thanks.

Many thanks gerrit,

I'll have a look at this one.

#### mrrudewords

• Fractal Frogurt
• Posts: 473
• Dat Mandel!
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #125 on: April 11, 2020, 12:25:59 PM »
@mrrudewords is it working on infinity.1.0.20?

It is indeed. Use the Embossed (slope) effect with (eg) Smooth (log) colouring.

#### mrrudewords

• Fractal Frogurt
• Posts: 473
• Dat Mandel!
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #126 on: April 11, 2020, 12:32:46 PM »
Hi mrrudewords,

Can you show us some images as an example of how it looks. Thanks.

Sure, this is a recent one which uses it. Also has other layers but the slope effect is clearly visible.

#### LionHeart

• Posts: 164
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #127 on: April 11, 2020, 01:04:16 PM »
Wow   mrrudewords,

It's beautiful. Well done. I do have a question though.

Quote
Now, when colouring the pixel, I check the surrounding (eight) pixels' heights to calculate how much brighter or darker this pixel should be.

What is the advantage at looking at 8 pixels as opposed to 4 as used in the code recommended by superheal? Does this add extra processing time?

Thanks.

#### mrrudewords

• Fractal Frogurt
• Posts: 473
• Dat Mandel!
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #128 on: April 11, 2020, 04:50:14 PM »
Wow   mrrudewords,

It's beautiful. Well done. I do have a question though.

What is the advantage at looking at 8 pixels as opposed to 4 as used in the code recommended by superheal? Does this add extra processing time?

Thanks.

I don't know if there is an advantage. It's just how i did it. There are many ways to skin a cat. It doesn't add to processing time in Infinity Fractal because the full image is calculated and this effect is applied during a recolour step as all surrounding heights will be known.

#### 3DickUlus

• Posts: 2193
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #129 on: April 11, 2020, 08:51:40 PM »
@mrrudewords a very striking image, well done! (that would be a contest winner  )

#### LionHeart

• Posts: 164
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #130 on: April 12, 2020, 03:39:28 AM »
Hi mrrudewords,

Whatever way you do it, the results are beautiful. Thanks for sharing the image with us.

#### mrrudewords

• Fractal Frogurt
• Posts: 473
• Dat Mandel!
##### Re: Algorithm for Rendering Slope in a Fractal
« Reply #131 on: April 14, 2020, 09:07:51 PM »
Thanks guys

### Similar Topics

###### Algorithm for Full Exploration of 3D Fractal in Realtime

Started by AranLeer on Fractal Mathematics And New Theories

13 Replies
857 Views
April 26, 2019, 07:34:08 AM
###### Correction for the Infinite Burning Ship Fractal Algorithm

Started by ixm.ibrahim on Fractal Mathematics And New Theories

40 Replies
1068 Views
April 10, 2021, 09:51:24 AM
by xenodreambuie
###### Custom 3D Fractal Formula Rendering on Mac

Started by jmseight on Noob's Corner

5 Replies
370 Views
May 11, 2020, 04:30:34 AM
by kosalos
###### Travel around 3d fractal world. Realtime rendering.

Started by sanbase on Fractal movie gallery

4 Replies
242 Views
February 18, 2021, 06:12:08 AM
by sanbase
###### How would quantum computing affect fractal rendering?

Started by greentexas on Programming

1 Replies
742 Views
December 12, 2017, 01:40:20 AM
by eiffie