|
David Makin
|
|
« Reply #151 on: August 27, 2009, 11:08:42 PM » |
|
Hi all, Regarding the "delta" method using the differences in smooth iteration count, a friend asked me for clarification so here's the pseudo-code I sent him, I thought more people may be interested ---------------------- Assume position on ray is "vp+alpha*d" where vp is the viewpoint and d is our normalised direction vector for the viewing ray. We want to scan along the ray segment from a start point dictated by our front cutting plane giving us a starting value for alpha to our end point dictated by the back cutting plane giving us an end value for alpha. We use an array "maxd[maxiter]" for storing maximum distances to step at each iteration level. Proceed as follows: For each ray: alpha = starting alpha (as dictated by front clip) Set all maxd[n] to a maximum step distance value (usually a user parameter) - n from 0 to maxiter step = 0 done = false binary search = false alpha found = end alpha repeat compute point p = vp + alpha*d oldstep = step iterate point p (set i to number of iterations done here and remember final values for computing smooth iteration) if not reached maxiter compute point p = vp + (alpha+abit)*d ;----- where abit is a user parameter, say 1e-10 Iterate point p if reached maxiter if oldstep==0 alpha found = current alpha done = true else step = oldstep/2 binary search = true alpha = alpha - step endif else compute smooth iteration value for first iteration s0 compute smooth iteration value for second iteration s1 compute directional DE = 1.0/(1.0+(1/abit)*abs(s1-s0)) if binary search step = oldstep/2 if DE>solid threshold ;--------- solid threshold is a user parameter, say 1e-4 alpha = alpha + step else alpha = alpha - step endif if step<min accuracy ;--- min accuracy is a user parameter, say 1e-8 alpha found = current alpha done = true endif elseif directional DE < solid threshold ;--------- solid threshold is a user parameter, say 1e-4 step = oldstep/2 binary search = true alpha = alpha - step else if maxd[i]<directional DE directional DE = maxd[i] else maxd[i] = directional DE endif if directional DE < maxd[i+1] ;***********ADDED maxd[i+1] = directional DE endif alpha = alpha + (step=directional DE/scale value) ;---- I use scale value = @scale*2.5 where @scale is a user parameter ; default 1.0 endif endif elseif oldstep==0 alpha found = current alpha done = true else step = oldstep/2 binary search = true alpha = alpha - step endif until done || alpha>=end position
---------------------- EDIT: Please note the "****ADDED section - I checked and it is actually necessary to conditionally store the DE value found as the maximum for the next iteration depth. EDIT#2: (August 28th 2009) The code above has now been modified such that if the first iteration does not reach maxiter but the second does then we test to see if it's the first point on the ray in which case we exit with solid found or if not the first point then we initiate the binary search. Also I've optimised the code such that smooth iteration values are only calculated when absolutely necessary and modified the binary search section slightly. EDIT #3: (October 5th 2009) Corrected the rather alarming oversight of not assigning the new calculated step distance to the "step" variable when not in the binary search I even made the same mistake in my original implimented version !
|
|
« Last Edit: October 06, 2009, 12:43:55 AM by David Makin »
|
Logged
|
|
|
|
Buddhi
|
|
« Reply #152 on: August 30, 2009, 01:39:28 PM » |
|
Hi David, you prepared very nice algorithm for DE. It looks very simple - good idea with this double computation. You don't have to derive formulas for derivatives. Sometimes numeric methods are the best and simple. Today I made some experiments with completely another approach to calculate iterations. I tried to convert Twenbee's idea to make rotations of vectors using complex numbers. First I normalize all vectors because when abs(z)=1 then abs(z^2)=abs(z). Then square of complex number is the same like doubling angle of vector without changing length of vector. I expected the same results as using trigonometric calculations but fractal looks different. Maybe I made some mistake somewhere. Below is C code for iteration double r = sqrt(xx*xx+yy*yy+zz*zz); xx = xx/r; yy = yy/r; zz = zz/r; /* --- rotation - axis Z */ //vector normalization: r1 = sqrt(xx*xx+yy*yy); xx = xx/r1; yy = yy/r1; zz = zz/r1; //complex numbers calculation newx1 = xx*xx - yy*yy; newy1 = 2.0*xx*yy; newz1 = zz; //---- rotation XY ------ r2 = sqrt(newx1*newx1+newy1*newy1); //normalization: r3 = sqrt(r2*r2+newz1*newz1); newx1 = newx1/r3; newy1 = newy1/r3; newz1 = newz1/r3; r2 = r2/r3; //complex numbers calculation newr2 = r2*r2 - newz1*newz1; newz2 = 2.0*r2*newz1; //spread result for 2 vectors (x and y) rr = newr2/r2; newx2 = newx1*rr; newy2 = newy1*rr;
//multiplying by normalization factors m=r*r*r1*r3; newx = newx2*m; newy = newy2*m; newz = newz2*m; xx = newx + aa; yy = newy + bb; zz = newz + cc;
...and the result: http://www.fractalforums.com/gallery/?sa=view;id=881
|
|
« Last Edit: August 30, 2009, 01:56:38 PM by Buddhi »
|
Logged
|
|
|
|
bugman
|
|
« Reply #153 on: August 30, 2009, 04:25:45 PM » |
|
Here are some higher power variations of Twinbee's Mandelbrot set using the following formula: {x,y,z}^n = r^n{cos(n*theta)cos(n*phi),sin(n*theta)cos(n*phi),-sin(n*phi)} r=sqrt(x²+y²+z²), theta=atan(y/x), phi=atan(z/sqrt(x²+y²))
(Can anyone tell me why Fractal Forums is making this image so small?)
|
|
« Last Edit: September 04, 2009, 09:29:17 PM by bugman, Reason: Bigger pictures »
|
Logged
|
|
|
|
lycium
|
|
« Reply #154 on: August 31, 2009, 02:46:55 PM » |
|
hi paul those higher power versions are amazing! basically instead of doubling angle, it does some (p/q)-symmetry, correct? (corresponding to the higher powers in the complex exponential)
|
|
|
Logged
|
|
|
|
twinbee
|
|
« Reply #155 on: September 02, 2009, 03:22:29 AM » |
|
Cool stuff indeed, like a Sea anemone or that shell I posted months ago. Not sure about the forum resoution thing, but here's a link to my fave version at a higher res than previously: http://www.bugman123.com/Hypercomplex/Mandelbrot-White8-large.jpgI'm guessing it's globally illuminated right? Interesting to see such ambient lighting with GI. I'd like to see more directional lighting (as well), and also without those small bright 'bits'. But that's not all, I'd like a 3000x3000 version if poss with less noise and maybe more iterations Seriously, love to see it close to those specs.
|
|
« Last Edit: September 02, 2009, 03:24:41 AM by twinbee »
|
Logged
|
|
|
|
Buddhi
|
|
« Reply #156 on: September 03, 2009, 06:33:59 PM » |
|
Hi Twinbee I'd like a 3000x3000 version if poss with less noise and maybe more iterations Seriously, love to see it close to those specs. Now I'm rendering z^7+b fractal using your trigonometric formula in 3000x3000x3000 resolution with 256 iterations. In few days it will be done . It should take about 50 hours to render
|
|
|
Logged
|
|
|
|
David Makin
|
|
« Reply #157 on: September 03, 2009, 09:30:13 PM » |
|
Hi Twinbee I'd like a 3000x3000 version if poss with less noise and maybe more iterations Seriously, love to see it close to those specs. Now I'm rendering z^7+b fractal using your trigonometric formula in 3000x3000x3000 resolution with 256 iterations. In few days it will be done . It should take about 50 hours to render Hi all, here's a zoom into said fractal: Magnification approx. *22 max iter. 256 - based on this detail 3000*3000*3000 is not enough ! Because of the number of multiplies and in particular because of the trig functions this 640*480 render took 12.5 minutes - but then again this PC/CPU/FPU is essentially an antique
|
|
|
Logged
|
|
|
|
cKleinhuis
|
|
« Reply #158 on: September 03, 2009, 10:16:38 PM » |
|
(Can anyone tell me why Fractal Forums is making this image so small?)
.... one image is the thumbnail, and the other resolution is rescaled to a max version, perhaps i can adjust the image size in the settings ... i will see ... bigger images can be placed in the gallery and linked !
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
cKleinhuis
|
|
« Reply #159 on: September 03, 2009, 10:20:15 PM » |
|
have i said that this thread is by far the most interesting here ?!?!?! new formulas, rendered in excellent ways, and really lots of people contribute ( too many to list them all ... ) great work guys, and keep on doing that i hope i will manage to create a fancy realtime gpu fractal renderer this year ( winter is standing in front of the door ) , i would love seeing those objects interactively ... keep on! @dave if the shape would be green it would look like a vegetable ! hmm, yummy yummy .... why is it that the outlines of the object are black !??!
|
|
« Last Edit: September 03, 2009, 10:33:46 PM by Trifox »
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
David Makin
|
|
« Reply #160 on: September 04, 2009, 01:18:03 AM » |
|
@dave if the shape would be green it would look like a vegetable ! hmm, yummy yummy .... why is it that the outlines of the object are black !??!
In the prototype UF formula I used the fractal is calculated in the global section and the normals are calculated directly from the z-buffer using the centre point and 4 adjacent points giving 4 triangles. The 4 adjacent points are tested for validity i.e. they're invalid if there's no surface or if the adjacent point is further than a given threshold away from the central point - the valid (up to four) (non-unit) normals are summed and the result is normalised. This render was my very first attempt at zooming into this particular fractal and I didn't play around tweaking the distance limit ("joined threshold") for deciding when points are valid for use in the normal calculation, the result being that on the edges of overlap the normals are calculated as being almost perpendicular to line of sight. The other reason I didn't tinker with the value is that the black outlines do actually help in this case since it's purely diffuse lighting without shadows and if I used the "correct" "joined threshold" the depth perception of the render would vanish (without using animation).
|
|
|
Logged
|
|
|
|
cKleinhuis
|
|
« Reply #161 on: September 04, 2009, 02:49:00 AM » |
|
@dave, i see, about the diffuse lighting you might be right, i am impressed by the shapes, the shapes get more interesting at higher iterations, anyway, i need to test those formulas also, because i was always disappointed with the shapes of the quaternions, even though they where 4d they just looked like a stretched mandelbrot around some axes ... those formulas really inspire me, and i am enjoying that they look how one ( me ? ) naturally thinks of a 3 ( or 4 ) D mandelbrot ... hehe, very nice mathematical experiments !!!
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
twinbee
|
|
« Reply #162 on: September 04, 2009, 03:06:23 AM » |
|
Now I'm rendering z^7+b fractal using your trigonometric formula in 3000x3000x3000 resolution with 256 iterations. In few days it will be done . It should take about 50 hours to render Can't wait! I think the thing that's dawning on me about the higher power version from bugman's sea anemone pic is that the 'bits have bits'. In other words, it's meeting the stricter definition of the word 'fractal' I wonder if the smaller bits have bits too. It's hard to tell from the resolution, but if they do, then it's anyone's guess what happens when you zoom in. What happens to the math to make these higher power versions more 'fractal-like' than the standard ^1 original?
|
|
|
Logged
|
|
|
|
David Makin
|
|
« Reply #163 on: September 04, 2009, 03:17:49 AM » |
|
@dave if the shape would be green it would look like a vegetable ! hmm, yummy yummy ....
Here you are: Mag *1284 max. iter. 256, delta DE threshold 1e-4 - in other words the same detail settings as the other versions I put in my 3D examples gallery. @Twinbee - yes, with decreased DE threshold (and maybe increased max. iter.) then the bits will have more bits I'm guessing but I think the fractal dimension of the *surface* could be 3 ?
|
|
|
Logged
|
|
|
|
twinbee
|
|
« Reply #164 on: September 04, 2009, 03:39:16 AM » |
|
@Twinbee - yes, with decreased DE threshold (and maybe increased max. iter.) then the bits will have more bits Ace, and the romanesco broccoli style veg is the proof by the looks of it Can you render the exact same veg shot again, but with higher iteration / delta DE threshold. Shadows too if poss...
|
|
|
Logged
|
|
|
|
|