|
cKleinhuis
|
|
« Reply #1 on: February 18, 2010, 12:33:50 AM » |
|
when thinking about it, a distance estimator is not an option here ? i have to binary search the ray for intersection ? please correct me if i am wrong
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
Timeroot
|
|
« Reply #2 on: February 18, 2010, 01:35:12 AM » |
|
Well, DE for the Mset is based on the Koebe 1/4 Theorem (yey 4 wikipedia!), which does not necessarily hold in the complex plane. That doesn't mean DE wouldn't work in vector space. If we have the mapping H nc(x), we could attempt distance estimation with ln(abs(d(H nc(x))/dc)) * abs(H nc(x)) / abs(d(H nc(x))/dc). The derivative of the function H with respect to c... isn't easy. d(H 1c(x))/dc is one, that's simple enough, but then we use the chain rule to extend the derivative with each iteration... if we have DE_n, z_n, z_n+1 as our variables, we could calculate DE_n+1 using some pretty weird conditional hooey. And you'd need to define multiplication of these 3D numbers. Hehe, I wrote this post in the hope I could think of something, and I've convinced myself in the meantime that it would utterly fail
|
|
|
Logged
|
Someday, man will understand primary theory; how every aspect of our universe has come about. Then we will describe all of physics, build a complete understanding of genetic engineering, catalog all planets, and find intelligent life. And then we'll just puzzle over fractals for eternity.
|
|
|
M Benesi
|
|
« Reply #3 on: February 18, 2010, 03:06:49 AM » |
|
It would have to be a conditional derivative, as the function is non-continuous... but even then for: point.x > 1 point.x = 2-point.x which is basically f(x) = 2 - x which makes f ' (x) = -1 which may or may not be useful for DE.
|
|
|
Logged
|
|
|
|
Timeroot
|
|
« Reply #4 on: February 18, 2010, 04:03:27 AM » |
|
Hmm... yeah, and for the spherical inversion you'd have a derivative of 0 for radii of less than 1/2, a derivative of 1 for radii greater than 1, and -1/x^2 for radii in between. Scaling just gives a derivative of 2. So I guess if we say H(x)=M(I(C(x))) + pixel (M means magnify, I is invert, C is cube), the derivative of H(x) = C'(x)*I'(C(x))*M'(I(C(x))), which could be calculated with the following code: loop: derivOld=deriv deriv=point.x if point.x > 1 || point.x < 1 then deriv=-1 else deriv=1 endif %Code for folding goes here... %Code for calculating radius goes here... if length<0.5 deriv=0 elseif length<1 deriv=-deriv/(point.x*point.x) endif %Code for spherical inversion goes here... deriv=deriv*2 %Code for scaling goes here... %Code for constant addition goes here... deriv=deriv*derivOld+1 I think this would work. Because DE isn't really legit for 3D space, you might do something like computing separate DE's using .x, .y, and .z values and averaging them or something...
|
|
|
Logged
|
Someday, man will understand primary theory; how every aspect of our universe has come about. Then we will describe all of physics, build a complete understanding of genetic engineering, catalog all planets, and find intelligent life. And then we'll just puzzle over fractals for eternity.
|
|
|
David Makin
|
|
« Reply #5 on: February 18, 2010, 04:05:41 AM » |
|
With respect to the analytical DE, it's probably better for this type of fractal to consider the analytical DE for IFS rather than standard escape-time fractals. For affine IFS (assuming uniform scaling and no skewing) then the DE is simply: cabs(final magnitude)/total scale Which actually makes sense since here "total scale" is the derivative, though quite why multiplying by log(cabs(final magnitude)) is definitely not correct in this case I'm not sure However for IFS with non-uniform scaling and/or skewing etc. then you have to get the magnitude of the determinant of the product of the transformation matrices used and of course use the correct matrix from each iteration - in the case of rendering escape-time IFS where the entire tree is traversed per point then you have to store the path of the closest route and compute the product of the matrices for that route after you've finished traversal - but in the case of the Mandelbox/Juliabox you only have one route.
|
|
|
Logged
|
|
|
|
fractalrebel
|
|
« Reply #6 on: February 19, 2010, 10:28:37 PM » |
|
One of the great things about UltraFractal 5 is that the architecture of the programming language allows plugins. My 3D Fractal Raytrace (UF5) was designed to handle virtually any 3D or 4D non-IFS fractal. The first plugins were for quaternion and FractInt style hypercomplex fractals, but it works with every other type I have tried. I have already prsesented some Mandelbulb examples, and now here is an Amazing Fractal example. 3D Fractal Raytrace (UF5) needs the derivative for the potential function for approaching the surface. For the Amazing Fractal I used the Delta DE potential method. DE in this context stands for DErivative, not Distance Estimate. In the Delta DE method the derivative is estimated at each iteration by adding a small delta to each of the x, y and z components and then subtracting the resultant value to get dx, dy and dz. This method works very well for the Amazing Fractal and for all other types I have tried. My other potential methods, which are often faster, require an explicit derivative calculation. I found that Timeroot's approach works reasonably well for my other potential methods.
Here is Cathedral, which uses scale = 3
Unfortunately the Ultrafractal database is down right now, and I don't know when it will be back up. I will upload the plugin for Amazing Fractal when the database is back up.
|
|
|
Logged
|
|
|
|
cKleinhuis
|
|
« Reply #7 on: March 24, 2010, 06:18:34 PM » |
|
ok, i have to ask again, about the Delta DE Method my understanding of the algorithm for Delta DE: z=initialzvalue while length(z)<bailout and itercount<maxIter z=fractalfunc(z) zderive = fractalfunc(z+delta)-z ?!??!?!? ? end
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
David Makin
|
|
« Reply #8 on: March 24, 2010, 10:44:23 PM » |
|
ok, i have to ask again, about the Delta DE Method my understanding of the algorithm for Delta DE: z=initialzvalue while length(z)<bailout and itercount<maxIter z=fractalfunc(z) zderive = fractalfunc(z+delta)-z ?!??!?!? ? end You missed a rather important factor (1/delta) and of course you don't add "delta" itself to z, but a vector of length delta in the appropriate direction (or directions if using Buddhi's method) i.e. zderive = (fractalfunc(z+delta*vector)-z)/delta Edit: correction that should be: zderive = (fractalfunc(initialz+delta*vector)-z)/delta
|
|
« Last Edit: March 24, 2010, 11:36:16 PM by David Makin »
|
Logged
|
|
|
|
cKleinhuis
|
|
« Reply #9 on: March 24, 2010, 10:59:37 PM » |
|
is that vector the delta from the last z value and the current one ? or how is that vector achieved ?!?
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
David Makin
|
|
« Reply #10 on: March 24, 2010, 11:26:00 PM » |
|
is that vector the delta from the last z value and the current one ? or how is that vector achieved ?!?
The vector (or vectors) is a unit vector in an appropriate direction, exactly what depending on whether you impliment my version or Buddhi's version of the method. In my version the vector is the unit direction vector of the viewing ray for the current pixel i.e. you iterate at position "step" on the ray and at position "step+delta". This method suffers from the same problem as my older delta DE method that uses the difference in the smooth iteration values rather than the final z value in that rays travelling parallel to the surface will produce very small zderiv values and so you have to program around this (for example using the maxdist array method that I've outlined in a number of places). In Buddhi's version you actually use 3 unit vectors (1,0,0), (0,1,0) and (0,0,1) i.e. your four locations to iterate are "step" position (px,py,pz) plus (px+delta,py,pz), (px,py+delta,pz) and (px,py,pz+delta). From these you calculate 3 values of zderiv and combine them using zderivfinal = sqrt(zderiv1^2+zderiv2^2+zderiv3^2) (at least that's what I believe Buddhi is doing). This method avoids the directionality problems associated with using the viewing ray vector. I haven't actually implimented this myself yet as obviously this requires 4 iterations per ray step rather than just 2. I should add that an alternative to using the pythagoras is (possibly) to simply use the largest of the 3 (absolute) values of zderiv or to use the quick and dirty methods (using max,med and min) for 3D pythagoras.
|
|
« Last Edit: March 25, 2010, 12:21:15 AM by David Makin »
|
Logged
|
|
|
|
reesej2
Guest
|
|
« Reply #11 on: March 24, 2010, 11:41:36 PM » |
|
Hm...can't say I've encountered this method before. I understand what you're doing to get zderive, but what is it used for? In Trifox's pseudocode, it's not actually applied.
|
|
|
Logged
|
|
|
|
David Makin
|
|
« Reply #12 on: March 24, 2010, 11:44:08 PM » |
|
Hm...can't say I've encountered this method before. I understand what you're doing to get zderive, but what is it used for? In Trifox's pseudocode, it's not actually applied.
It's simply applied to get a distance estimate in place of the analytical derivative i.e. DE = 0.5*log(cabs(z))*cabs(z)/zderiv Note that for Buddhi's method you can avoid the triple divide by delta by calculating zderiv without using the divide and then use: DE = 0.5*delta*log(cabs(z))*cabs(z)/zderiv
|
|
« Last Edit: March 24, 2010, 11:55:51 PM by David Makin »
|
Logged
|
|
|
|
David Makin
|
|
« Reply #13 on: March 25, 2010, 12:11:18 AM » |
|
With respect to the analytical derivative for the Mandelbox can someone more maths savvy than myself please answer the question as to what is the derivative of f(x,y,z) where f(x,y,z)=(-x,y,z) or f(x,y,z)=(x,-y,z) or f(x,y,z)=(x,y,-z) as we need the derivative for the rectangular folding ? Can we just use the obvious e.g. if the formula is say folding the x as (v-x) then we simply negate dx ?
|
|
« Last Edit: March 25, 2010, 12:16:16 AM by David Makin »
|
Logged
|
|
|
|
David Makin
|
|
« Reply #14 on: March 25, 2010, 12:24:33 AM » |
|
Hm...can't say I've encountered this method before. I understand what you're doing to get zderive, but what is it used for? In Trifox's pseudocode, it's not actually applied.
It's simply applied to get a distance estimate in place of the analytical derivative i.e. DE = 0.5*log(cabs(z))*cabs(z)/zderiv Note that for Buddhi's method you can avoid the triple divide by delta by calculating zderiv without using the divide and then use: DE = 0.5*delta*log(cabs(z))*cabs(z)/zderiv I should point out that that's how the delta z method is applied, my older delta DE method using the smooth iteration values is slightly different.
|
|
|
Logged
|
|
|
|
|