Logo by Trifox - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. March 28, 2024, 05:27:08 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: DE estimation - help needed  (Read 1849 times)
0 Members and 1 Guest are viewing this topic.
chaospro
Guest
« on: April 11, 2010, 10:39:22 AM »

Hi there,

perhaps somebody could guide me as to what I'm doing wrong:
I tried to implement distance estimation in ChaosPro. Well, it basically works (see image at the bottom), but not as good as expected:
The distances are quite far from the "real" distances: They are so far away from the real distances that it's basically useless.
It only works as the real distance is round about 10 times as large as the "calculated" distance, and as such, the ray marching algorithm produces some "result".

A short example:
The power 8 Mandelbulb was examined at a specific pixel (image at the bottom: pixel at the center of the image):
Here is the result - Calculated distance using analytic DE compared with actual distance (when object was actually hit):

1. Step:  0.516080     <->     1.001526
2. Step:  0.251703     <->     0.485446
3. Step:  0.050030     <->     0.233743
4. Step:  0.041824     <->     0.183713
5. Step:  0.032613     <->     0.141888
6. Step:  0.023894     <->     0.109275
7. Step:  0.016751     <->     0.085381
8. Step:  0.005247     <->     0.068629
9. Step:  0.005339     <->     0.063382
10. Step: 0.005437     <->     0.058043
11. Step: 0.005581     <->     0.052605
12. Step: 0.005807     <->     0.047024
13. Step: 0.006127     <->     0.041216
14. Step: 0.006496     <->     0.035089
15. Step: 0.006776     <->     0.028593
16. Step: 0.006713     <->     0.021817
17. Step: 0.006030     <->     0.015103
18. Step: 0.002201     <->     0.009073
19. Step: 0.002139     <->     0.006871
20. Step: 0.001933     <->     0.004732
[...]

As you can see, the estimated distance is much smaller than the real distance, and as such, too many steps are necessary and also finally overstepping occurs.

You can reproduce that and experiment, I would be really glad for some hints and help...
In order to reproduce it, download a special version of ChaosPro using the following link:
http://www.chaospro.de/download/cprode.zip
(the archive contains two files: ChaosPro.exe and the formula file DETest.cfm)
I assume you have already installed the "normal" distribution...
Then replace the normal ChaosPro.exe with the new file found in that downloaded archive.
After that copy the formula file DETest.cfm to the folder "Compiler" (normally found in Documents and Settings/<Username>/ApplicationData/ChaosPro 4.0/Formulas/Compiler)

And then use the following parameter file (just copy&paste into ChaosPro).
It will recreate the image displayed below. The parameter tab allows you to specify a screen pixel to examine. The first 20 steps are written back to the parameters found in the parameter tab and allow to easily examine different points and algorithms.

In order to experiment open the formula in the file DETest.cfm, the function "void loop(void)" does all calculations used for mandelbulb and distance estimation and is rather small (about 50 lines of code), as it only needs the iteration formulas and distance estimation (the other things are done by ChaosPro itself).

There you can see the DE formula, which currently is: a = 0.2*sqrt(7)*log(r2)*sqrt(r2)/Rdz, as suggested by David Makin.

Kind regards,
Martin


MandelDETest  {
  credits="Martin;2/8/2010/21/4"  commentTemplate="Saved on $month$, \
  $day$ $year$ at $hour$:$min$:$sec$\nDate: $date$\nTime: $time$\nRes\
  olution: $xdots$ x $ydots$\nCalculation time: $calctime$\nVersion: \
  $version$"
  CommentText="Saved on Apr, 11 2010 at 09:53:56\nDate: Apr 11, 2010\\
  nTime: 09:53:56\nResolution: 480 x 480\nCalculation time: 00:00:18.\
  552\nVersion: 4.0"
  creationTime=2010/2/8/21/4/52 saveTime=2010/4/11/9/53/56
  Creator="Martin" ModifiedBy="Martin" calcTime=18614 version=4.0
  Type=Quaternion Subtype=0 Width=480 WinWidth=479 WinHeight=389
  DisplayDepth=24 roughness=+0 AOIntensity=+0.4
formula:
  filename="DETest.cfm" entry="Mandel3DDE_MP_TEST" p_bailout=100
  p_n=8 p_threshold=0.001 p_ep=240/240 maxiter=10
  precision=0 highresmult=1 backtrace=100 percheck=3
inside:
  filename="Quaternions.ccl" entry="Orbital" p_bOrbit=1 p_iternum=0
  p_frmltype1="Orbit Distance" p_frmltype2="Spherical" f_fn1=sin
  f_fn2=sin density=0.01 solid=0 background=0
dimensional:
  observer=-0.020122693348948/1.3271777412767/-1.4960595978343
  topview=0.011340338161161/-0.7479438326197/-0.66366514145053
  backClippingPlane=2.4992675911551
lighting:
  light0Relative=yes
  light0Pos=1057.4078019426/451.41976862365/-1296.5100589059
  light0Ambient=0.2 light0Diffuse=0.8 light0Shiny=0.3
  light0Reflection=20 light0IntensSat=1 light0SpecularSat=0.3
  light0SpecularLum=0
gradient:
  smooth=no colormodel=CM_RGB knotmode=each dragknotmode=global
  Offset=0 knotr=(1,252) knotr=(29,252) knotr=(114,0) knotr=(198,252)
  knotr=(251,252) knotg=(1,80) knotg=(28,0) knotg=(114,0)
  knotg=(199,252) knotg=(251,96) knotb=(29,0) knotb=(114,252)
  knotb=(198,0)
}


Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #1 on: April 11, 2010, 09:31:28 PM »

Hi Martin, you must have missed the post where I said that modifying the DE based on the power wasn't actually necessary (i.e. after further investigation I changed the formula I was using).

Now for the Mandelbulbs, for the distance to test against the threshold I use the "original" formula, in unoptimised terms:

  DE = 0.5*cabs(z)*log(cabs(z))/cabs(derivative)

And if we're not below the threshold I then apply further adjustment to get a step distance:

  step = DE*(0.9/@accuracy)

Note also that for Julia sets for plain z^power+c because no additions are involved then you can accumualte the derivative simply as:

  dr = power*dr*magnitude^(power-1)

(all floats) and then use DE = 0.5*cabs(z)*log(cabs(z))/dr
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
chaospro
Guest
« Reply #2 on: April 12, 2010, 09:41:23 PM »

Dear David,

Hi Martin, you must have missed the post where I said that modifying the DE based on the power wasn't actually necessary (i.e. after further investigation I changed the formula I was using).
[...]

ok, reviewed my code once again...this was one of the problems. Did not read carefully enough.

So finally DE is working, thank you very much smiley Now I can advance to the more advanced topics in DE like the star fix mentioned in the other post.

Here is the first image from ChaosPro using "real" DE:


Kind regards,
Martin


Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #3 on: April 19, 2010, 02:29:28 AM »

Hi all,

Martin: for the Juliabulbs I said use:

DE = 0.5*cabs(z)*log(cabs(z))/dr

I was wrong, I forgot that in my implimentation I discovered that the 0.5 should be omitted for the Julias, i.e. that should be:

DE = cabs(z)*log(cabs(z))/dr
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Fractal animation needed Commission an Artist shufflelot 10 9838 Last post October 02, 2010, 08:49:38 PM
by Sockratease
Programmer needed to add a few lines of code to RenderFlam3 Let's collaborate on something! « 1 2 » 3dpete 15 5501 Last post August 01, 2012, 12:21:35 PM
by thargor6
DragonKIFS - promising formula but help needed IFS - Iterated Function Systems « 1 2 » Kali 17 17709 Last post November 25, 2013, 04:21:06 PM
by knighty
intros and outros needed!!! production « 1 2 3 » cKleinhuis 40 9081 Last post November 28, 2012, 11:24:08 PM
by toxic-dwarf
help needed for introduction chaosTube - History cKleinhuis 4 1360 Last post January 24, 2013, 11:03:59 PM
by Madman

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.343 seconds with 26 queries. (Pretty URLs adds 0.009s, 2q)