Please help me understand the formulas to generate the band colorings of a fractal that use the formulas Triangle Inequality / Stripe Average / Average Curvature...etc as explained by JUssie Harkonen.
I am not a math genius so it needs to be dumbed down.
It seems like when I read his thesis... i think I understand it... but when I go to implement it, It's not working. It's close..... It seems like I'm not averaging far enough ahead or behind.... and when I try to average, it always loooks way worse.... all one color..... Not sure if i'm averaging incorrectly.... or using the value I obtain incorrectly.
I have read the two threads that talk about this subject and still do not understand.
I have tried many ways and i can't seem to get it to eliminate the banding:
- All attempts had tested bailout values at 4, 1000, 1000000000 (thats the max value i can use without causing some overflow error)
- Dividing the arcTanSum by the number of iterations.
- Totaling only the last four values of the ArcTanSum and dividing by 4
- Calculating 1 to 4 iterations past the bailout of Z
- Using the arcTanSum value as a direct color value
- Using the arcTanSum value as part of the smooth coloring formula - this is the closest I've got but it gets messy towards the fractal "edge"
- I've watched videos about the catmull-Rom spline interpolation..... have no idea what numbers to use where or what to do with them if i even got them.
I am not sure if the things I have tried WERE correct idea but implemented INCORRECTLY...... or just plain wrong.
Here's my code:
I've left any code out that I figured was unimportant/ didn't affect calculations
For Y = 1 To H ' Image Height
For x = 1 To W ' Image Width
cRE = (((cX + x) - W / 2) * 4 / W) * Zoom
cIM = (((cY + Y) - H / 2) * 4 / W) * Zoom
Rx = 0
Ry = 0
inside = False
arcTanSum= 0
For I = 0 To MaxIterations
lastZ = Z
orX = Rx
orY = Ry
newX = Rx * Rx - Ry * Ry + cRE
Ry = (Rx + Rx) * Ry + cIM
Rx = newX
Z = Rx * Rx + Ry * Ry
arcTanSum = arcTanSum + 0.5 * Math.Sin(Math.Atan2(Ry, Rx)) + 0.5 'Formula I got from another thread from this forumn
If Z > EscapeVal Then
c = I
inside = True
Exit For
End If
Next
If inside Then
For ix = 0 To 3
newX = Rx * Rx - Ry * Ry + cRE
Ry = (Rx + Rx) * Ry + cIM
Rx = newX
Z = Rx * Rx + Ry * Ry
arcTanSum = arcTanSum+ 0.5 * Math.Sin(Math.Atan2(Ry, Rx)) + 0.5
Next
mu = ((arcTanSum)) + 1 - Math.Log(Math.Log((Math.Sqrt(Z)))) / Math.Log(EscapeVal) ' This formula was initially used with variable 'C' (the iteration count at escape) to generate fraction for smooth iteration coloring
clr1 = Int(mu)
t2 = mu - clr1
t1 = 1 - t2
clr1 = clr1
clr2 = (clr1 + 1)
r = (Math.Sin(FreqR * (clr1) + PhaseR) * 127 + 128) * t1 + (Math.Sin(FreqR * (clr2) + PhaseR) * 127 + 128) * t2 'SMOOTH COLOR
g = (Math.Sin(FreqG * (clr1) + PhaseG) * 127 + 128) * t1 + (Math.Sin(FreqG * (clr2) + PhaseG) * 127 + 128) * t2 'SMOOTH COLOR
b = (Math.Sin(FreqB * (clr1) + PhaseB) * 127 + 128) * t1 + (Math.Sin(FreqB * (clr2) + PhaseB) * 127 + 128) * t2 'SMOOTH COLOR
Else
r = 0
g = 0
b = 0
End If
Next
Next
Here's one of the last fractals I generated attached.
I have visited many, many....many bulletin boards in my days seeking answers....and have always found. I have never posted a question myself because I've always found the answer and understood it enough to continue on. Please excuse any newbie mistakes I may have made in making this post.