Thanks Gerald, I'm beginning to get a bit of feel for what's going on in these formulas. Very ingenious! I marvel that you are so conversant with this type of programming. Is writing code then your profession? If so, what is your speciality? (Just curious, if such questions aren't too personal... I promise not to sell the info to telemarketers or junk-mailers. :-) BTW, could you give me some initial values for '3dJulibrot_simple' that generate a nice image? Thanks again. Ciao, Russell ----- Original Message ----- From: "Gerald K. Dobiasovsky" <gerald.dob@aon.at> To: "Fractint and General Fractals Discussion" <fractint@mailman.xmission.com> Subject: Re: [Fractint] Re: quaternion product correction Date: Tue, 8 Nov 2005 09:16:01 +0100
Russell Walsmith wrote:
I'm still stoked on this formula. Morgan Owens and Hiram Berry should see >this!
Russ,
There's really not much to it, provided one removes the additional stuff like 3d rotations and the like (and if a certain formula author wouldn't be too lazy to use comments in his "works" at all ;-)).
One faces two problems in writing a formula for greyscale depth display:
1) The formula parser doesn't provide a direct way to assign a color to the given pixel, only hardwired methods are available.
2) Each Fractint formula only has one main iteration loop, no constructs for nested loops are part of the parser.
1) The first point comes up in "standard" 2d fractal images as well, and a number of ways to emulate the behaviour of a "color=..." keyword have been worked out by different persons, often independently.
The general idea is to (mis)use the given variable "z". Through "z" Fractint tracks a pixel's orbit, checks for periodicity to shorten calculations, tests for finite attractors, and uses its content in some of the coloring methods.
The coloring method I am exploiting is "summ". By enabling it, Fractint uses iter + real(z) + imag(z) as the color index. Now, to force a certain color number, I only need to put into "z" that color number *minus the iteration count*. Since Fractint adds this count, it effectively cancels it, leaving only the color index number (and the imaginary part of "z" in this case is zero anyway, so no problem here).
2) The second point comes up because of the 3d nature of the scene. One has to step from near towards far clipping plane, at each step iterating to determine if the point is still outside the fractal, only stopping if either the fractal or the far clipping plane is reached. This, however, is easily wrapped up into one loop. One only has to make sure Fractint's own iteration count doesn't get in the way.
--- Below I have put a formula stripped of all the additional stuff that makes it hard to see what's going on (and - cough - even put comments into it!)
Random note: Fractint allows color 1 to 255 for this type of outside coloring. Since one background color is needed, 254 colors remain for the fractal. Therefore the max. number of (depth) slices is 254.
Ah, and see the change from "p3 >= i" to "p3 > i" (last line); all the years(!) it didn't dawn on me it causes one iteration too many :-/
Regards, Gerald
---------------------------- Formula follows -------------------------------
3dJulibrot_simple {;periodicity=no, outside=summ ;maxit > p3real*(p3imag+1) ;(maxit = Fractint's Maximum Iterations on <x> screen) ;----------------------------------------------------- ;p1 : Far clipping Julia parameter c ;p2 : Near clipping Julia parameter c ;p3 real: Maxiter per slice ;p3 imag: Number of slices - 1 ;p4 real: Bailout ;----------------------------------------------------- stepnum = imag(p3) delta = (p1-p2)/stepnum ;Complex step to add to current c for next slice zz = pixel ;Initialize screen variable c = p2 ;Start with near clipping Julia parameter c j = m = i = 0: ;j ... overall loop count ;m ... slice number ;i ... loop count for each slice zz = sqr(zz) + c ;Iteration formula IF (p4 >= |zz|) ;Bailout condition test i = i + 1 ;No bailout, increment slice loop count ELSE ;Bailout, so... i = 0 ; reset slice loop count m = m + 1 ; increment slice number c = c + delta ; update Julia c to next slice's value zz = pixel ; re-initialize screen variable ENDIF z = m - j ;Feed slice number to Fractint display engine, ; compensating for overall iterations. j = j + 1 ;Increment overall loop count stepnum >= m && p3 > i ;Keep going if not past last slice and if not ; inside set (maxiter per slice not reached). }
---------------------------- End of formula -------------------------------
_______________________________________________ Fractint mailing list Fractint@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/fractint