Help with coloring algorithms for Julia / Mandelbrot sets

Currently, my methods of colouring the set are either too colorful, or it does this:

80 iterations:

144 iterations (same coordinate & same level of zooming):

I am looking for one that looks similar to the ones I presented (i.e. grayscale one), yet doesn’t lose details when the max iteration go up. Some explanation on how it works will be sweet too (unless it’s too simple).

1 Like

Can’t really help without seeing any code

Well as @ThanksRoBama mentioned we need to see the code and we need more context. Do you only need one color done or more than one?

The code itself is rather simple.

Basically, I just need to generate a RGB color based off of the amount of iterations done, something like

Color3.new(sin(0.025*n), sin(0.05*n), sin(0.075*n)) --// n is the number of iterations done.

Can generate a gradient like this:

But as I mentioned, I am failing to come up with a grayscale one that doesn’t lose detail when the amount of max iteration goes up.

I’m really curious as to how you’re rendering that. Did you write that in JavaScript?
I don’t see something like that being viable to write in Roblox lua

That’s an insane amount of frames. (1280*720)
Crashes everytime doing the cleanup (i.e. closing the game in studio)

1 Like

im surprised you know how to code the mandelbrot set but not know how basic interpolation works. just get your epoch and divide it by the iteration. heres something i coded up in like 5 minutes in shadertoy

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 c = fragCoord/iResolution.xy;
    vec3 s = vec3(0.0, 0.0, 0.0);
    vec3 e = vec3(0.0, 1.0, 0.5);
    c -= vec2(0.5, 0.5);
    c *= vec2(3.5, 2.5);
    c += vec2(-.75, 0.);
    vec3 col;
    vec2 z = c;
    for (int i =0; i<50; i++) {
      float d = z.y;
      float temp = d;
      d = z.x*d + z.x*d;
      z = vec2(z.x*z.x+(temp*temp*-1.), d)+c;
        if (length(z) > 2.) {
          col = s + (e-s) * float(i)/50.;
        }
    }
    fragColor = vec4(col,1.0);
}