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

Login with username, password and session length

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

0 Members and 1 Guest are viewing this topic.

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
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

Offline 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)

Offline 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?

Offline 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.

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
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.

Offline 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.

Offline 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.

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
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.

Offline 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.

Offline 3DickUlus

  • Administrator
  • *******
  • Posts: 2193
    • Digilantism
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  :thumbs: )

Offline LionHeart

  • Uploader
  • *
  • Posts: 164
    • ManpWIN Fractal Generator
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.

Offline 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 8)

Glad to be of service ;)