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)
}