• May 08, 2021, 06:46:24 PM

Author Topic:  Smooth 1D coloring  (Read 1246 times)

0 Members and 1 Guest are viewing this topic.

Spyke

• Strange Attractor
• Posts: 98
Smooth 1D coloring
« on: April 17, 2019, 12:27:28 AM »
This thread is intended to be a catalog of images demonstrating the different parameters and coloring formulas from the discussions here: https://fractalforums.org/fractal-mathematics-and-new-theories/28/smooth-1d-coloring/2753/msg13961#msg13961

I thought a separate thread for images would be more appropriate. However, if the admins think this is a stupid idea, let me know and I will fix it.

I started out the day with such good intentions. But as usual I am easily distracted. After a tweak here on top of a quick experiment there, the day got away from me. So today, I have only one image to offer. It is an example of the algorithm, but with all those tweaks and experiments, it is far from the simple examples I intended or the discussion on the other thread. (I hope to get back to the catalog thing Friday…)

Black Hole Sun / Fractal Version

Earl Hinrichs, offering free opinions on everything.

gerrit

• 3f
• Posts: 2407
Re: Smooth 1D coloring
« Reply #1 on: April 17, 2019, 02:11:41 AM »
Looks nice, these halo's are pretty.
Here's one with R=3 and power 2, and a pseudo distance estimate coloring ($$|z|*log(|z|)/|z'|$$) for comparison. Formula is $$z \leftarrow z^2 e^{-1/z} + c.$$

3DickUlus

• Posts: 2213
Re: Smooth 1D coloring
« Reply #2 on: April 17, 2019, 06:30:33 AM »
Thank you Spyke and gerrit

gerrit

• 3f
• Posts: 2407
Re: Smooth 1D coloring
« Reply #3 on: April 18, 2019, 09:50:17 AM »
Mandelbrot foam. Looks unpleasantly banded with just iteration coloring. Picture used power 2. There still seem some bands but I like how they look (bigger power gets rid of them).
My UF color method:
Code: [Select]
SmoothIters {init:  float func g(float x, float R,int p)     float y = 0     y = (1 - x/R)     ; y = (1 - log(x)/log(R))     if y<0        y = 0     endif     return y^p  endfunc  float acc = 0loop:  float az = cabs(#z)  if az <= @R     acc = acc + g(az,@R,@p)  endif final:  #index = acc/10 * @csdefault:  title = "SmoothIters"  int param p    caption = "Exponent"    default = 2  endparam  float param R    caption = "Radius"    default = 2.0  endparam  float param cs    caption = "Color speed"    default = 1  endparam}

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #4 on: April 19, 2019, 01:01:31 AM »
I started this thread with the intent to provide a map/catalog of the coloring algorithm described here: https://fractalforums.org/fractal-mathematics-and-new-theories/28/smooth-1d-coloring/2753

To recap, $$s(c) = \sum_{i=0}^{N}\max(g(z_i),0)$$, with some simple restrictions on g, provides a continuous value with respect to pixel coordinate c.

The default is $$g(z) = (1-|z|/R)^p$$. 0 < R < escape radius, p >= 1. Often R is the escape radius, but that is not an absolute requirement. For each of the next few images the center is at -0.9125+9.2732i, and the image width is 0.125, height is set for 1 to 1 aspect ratio.

Here R = 1000000, p = 1.

The first example is just to demonstrate that in some sense this method is a generalization of the simple iteration count. It is designed to look like iteration count coloring, and not to demonstrate any advantage.

The typical escaping orbit, will spend some time with $$|z_i|<2$$, then blow up very quickly (doubly exponentially) past the escape threshold. Except for a small area close to c=-2, it will take just five steps to get from $$|z_i|>2$$ to $$|z_{i+5}| > 1e6$$. The value inside the summation is very close to 1 while $$|z_i| < 2$$, then quickly becomes 0 when $$|z_i| > R$$. The coloring function is continuous, but the derivative is not. The derivative alternates between mostly flat, close to 0, and very steep for orbits that land very close to the fractal boundary.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #5 on: April 19, 2019, 01:16:59 AM »
R=2, p=1.

TMI Department: I classify these as 1D coloring because a single real value is the hand-off from the fractal calculation to the coloring method. The coloring method is not specified, it is something that turns a real number into a color. It is assumed that the coloring method is continuous. It could be a direct calculation of RGB values from the input. If it is a list of colors, there should be interpolation between the colors so that the output color varies continuously with the input. Anyway, let's call the coloring method a palette, and the input an index and hide whatever goes on inside.

Suppose you had the usual iteration count value for color index and compare that to the same image but multiply the index by 0.5 before sending it to the palette. The resulting image would have half the color range, the color bands in the same place, but smaller color difference between bands.

A good color method lets you tweak the color entropy. You can scale the input, apply square root or log functions, etc. Now it becomes fuzzy where exactly the hand-off between fractal calculation and color algorithm. You could undo the compression on the fractal calculation side in the previous paragraph with a re-scaling on the coloring side.

Full disclosure fine print:  Notice that that for all z, $$1-|z|/R_1 < 1-|z|/R_2$$ when $$0 < R_1 < R_2$$. So reducing R makes the summation, our color index, everywhere smaller. I want to show the same image with different parameters, but every time I change a parameter, the overall color range shifts. I want to remove the effects of the color range shift for comparisons. So, for each of these images, there are also some undocumented parameter tweaks in the palette. I added a simple multiplier to the output of the color index calculation. Each image is computed in two passes, the first pass computes the average value of the escaping pixels, then the reciprocal of that average becomes the multiplier. Thus after the second pass the average color index for escaping pixels, is 1.

OK, that's out of the way. Reducing R to a reasonable number removes most of the color banding present in the iteration count coloring.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #6 on: April 19, 2019, 01:20:18 AM »
R = 2.0, p = 2.0.

When p = 1, the resulting color index function is $$C^0$$ but not $$C^1$$. In other words, the function is continuous, but the derivative has discontinuities. When p = 2, the function has a continuous derivative and becomes$$C^1$$. The faint bands in the R=2, p=1 case disappear.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #7 on: April 19, 2019, 01:23:23 AM »
R = 2.0, p = 4.0

Setting p = 4 makes the second and third derivatives of the index function continuous. I can't tell the difference with respect to smoothness. The coloring shifts a little bit, the images have the same average color, but with differences in color distribution.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #8 on: April 19, 2019, 01:32:29 AM »
R = 2.0, p = 1.0.

There are two parameters to tweak. R and p. The R=2, p=1 case is already posted here, see https://fractalforums.org/image-threads/25/smooth-1d-coloring/2755/msg13993#msg13993. I want to head off in a different direction this time fiddling with R. Please scroll back a little and look at the earlier image. To save bandwidth I am not going to duplicate it here.

In that image you notice different shades of blue in the bigger empty areas. While the different shades are noticeable, the changes are gradual. They are not the jarring discontinuities in escape count coloring. These changes are pleasing to the eye. The super smooth coloring where p=2 and p=4 is plain and boring. p=1 provides a little bit of interest in the open area, without any distraction from the main fractal features. I liken it to brush strokes in a painting. The p>=2 variants are like photographs, whereas p=1 is a painting with visible brush strokes. Aesthetics are of course subjective, and this is just my opinion.

Fractals may have photographic level mathematical purity, bright kaleidoscopic color bands, or strings of orbit trap pearls. It is all good. My tastes are all over the board. But most of the time I like some artistic embellishment while preserving the fractal soul.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #9 on: April 19, 2019, 01:35:55 AM »
R=1.0, p=1.0.

For the record, I am using escape radius = 4. R here is for the coloring function. Orbits can leave $$|z|<1$$, hang out in $$1 < |z| < 2$$ for a while, then return to $$|z| < 1$$. Orbit points only influence to final color when $$|z| < 1$$. The result is greater emphasis on orbits with most points in $$|z| < 1$$.

You see some "brush strokes", but they do not follow the usual contour lines. They seem to backup and support the fractal.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #10 on: April 19, 2019, 01:40:26 AM »
R = 0.8, p = 1
R = 0.7, p = 1

Two more examples where the background actively highlights, even spotlights, the foreground fractal, without being a distraction.

gerrit

• 3f
• Posts: 2407
Re: Smooth 1D coloring
« Reply #11 on: April 19, 2019, 06:51:28 AM »
Detail of the Julia set of an order 32 polynomial, R=2, first with p=1, then p=2. Different but both nice I think.
No reason power has to be an integer btw, one could animate it for "slider" tuning as you can do in UF.

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #12 on: April 19, 2019, 03:37:17 PM »
R=1.0, p=2.0
R=0.8, p=2.0
R=0.7, p=2.0

My three previous images, this time with p = 2.0 ($$C^1$$ smooth coloring). The light bands, or "brush strokes" are gone, but the background still actively complements and enhances the fractal foreground. The background kind of flows around the fractal shape and helps it pop out of the image.

gerrit suggested a slider for controlling these parameters. There is kind of a poor man's slider here. Scroll through the images with the mouse wheel.

claude

• 3f
• Posts: 1850
Re: Smooth 1D coloring
« Reply #13 on: April 19, 2019, 06:23:42 PM »
$\left( 1 - \left(\frac{|z|}{R}\right)^q \right)^p$

Spyke

• Strange Attractor
• Posts: 98
Re: Smooth 1D coloring
« Reply #14 on: April 19, 2019, 09:42:53 PM »
I used to use q=2 to avoid a square root, it did not make a significant difference. q kind of fights against p. For C^1 smoothness, the derivative at |z| = R should be 0. (Replace |z| with x and call it a function of real number x.) Increasing q, increases the absolute value of the derivative at near |z|=R, larger p decreases it.

The actual function is $$(max((1-|z|/R)^q,0)^p$$.

Here are
R=2, p=2, q=2
R=2, p=2, q=4
R=1, p=1, q=10

Similar Topics

Smooth 1D coloring

Started by Spyke on Fractal Mathematics And New Theories

9 Replies
1071 Views
June 11, 2019, 06:09:48 PM
by Spyke
Smooth coloring for z->exp(z)+c

Started by shapeweaver on Fractal Mathematics And New Theories

5 Replies
485 Views
March 04, 2020, 12:33:54 PM
by claude
Smooth Coloring for Sine Fractal?

Started by fractaleye on Fractal Mathematics And New Theories

4 Replies
234 Views
June 10, 2020, 12:09:17 PM
by marcm200
Smooth histogram coloring failure

Started by Smolt on Programming

3 Replies
474 Views
August 23, 2019, 03:47:41 AM
by Duncan C
Exporting smooth mesh

Started by meshcarver on Mandelbulb3d

18 Replies
1437 Views
November 23, 2019, 11:45:42 AM
by siriux