@Makin:
currently i use the 4 point method on the R-bailout values, so i should try it on the smoothed Iterations again. I did that before with only one delta, but didnt got the fine details.
Are you using 3 deltas or only one?
(Because this makes much more difference in the time consumption, i guess)
The array checking is also on the todo list, i hope that it can reduce time consumption without missing details...
Buddhi's results are really great, the shading i am using is:
(Ambient + Diffuse * HardShadow/2 + Specular * HardShadow) * SoftShadow
and fading to Background.
The soft shadow is nearly for free because i calculate it just from the Z values of the pixels, using wavelets.
Not perfect, but a good compromise between speed and realism.
@Walther:
It is the "standard" mandelbulb with -Z, a code snippet:
if Option = MinusZ then O2 := -2 else O2 := 2;
X1 := C1;
X2 := C2;
X3 := C3;
S1 := X1 * X1;
S2 := X2 * X2;
S3 := X3 * X3;
ItResultI := 0;
repeat
if S2 < 1e-40 then
begin
X3 := O2 * X3 * Abs(X1) + C3;
X1 := S1 - S3 + C1;
X2 := C2;
end
else
begin
XT := S1 + S2;
X3 := O2 * X3 * Sqrt(XT) + C3;
XT := (XT - S3) / XT;
X2 := 2 * XT * X1 * X2 + C2;
X1 := XT * (S1 - S2) + C1;
end;
S1 := X1 * X1;
S2 := X2 * X2;
S3 := X3 * X3;
Rout := S1 + S2 + S3;
Inc(ItResultI);
until (ItResultI >= maxIt) or (Rout > RStop);
Rout := Sqrt(Rout);
if Rout <= 1 then
SmoothItD := ItResultI
else
SmoothItD := ItResultI - Log10(Log10(Rout)) * LogC21d;
where LogC21d is: 1/Log10(2)
I don't think you can use log10() - you need natural log() or ln() if you prefer.
Although logx(a)/logx(b) is the same for all x, logx(logx(a))/logx(b) is not.
Also instead of using 1/log(2) you should only use that when bailout occurs on the first iteration, otherwise instead of multiplying by 1/log(2) you should divide by log(log(Rout)/log(OldRout)) where OldRout is the magnitude from the penultimate iteration:
e.g.
if Option = MinusZ then O2 := -2 else O2 := 2;
X1 := C1;
X2 := C2;
X3 := C3;
S1 := X1 * X1;
S2 := X2 * X2;
S3 := X3 * X3;
ItResultI := 0;
repeat
oldRout := Rout
if S2 < 1e-40 then
begin
X3 := O2 * X3 * Abs(X1) + C3;
X1 := S1 - S3 + C1;
X2 := C2;
end
else
begin
XT := S1 + S2;
X3 := O2 * X3 * Sqrt(XT) + C3;
XT := (XT - S3) / XT;
X2 := 2 * XT * X1 * X2 + C2;
X1 := XT * (S1 - S2) + C1;
end;
S1 := X1 * X1;
S2 := X2 * X2;
S3 := X3 * X3;
Rout := S1 + S2 + S3;
Inc(ItResultI);
until (ItResultI >= maxIt) or (Rout > RStop);
; Rout := Sqrt(Rout); Omit this unless you need it for something else - the 0.5*ln does the same job faster
if Rout <= 1 then
SmoothItD := ItResultI
elseif ItResultI<2
SmoothItD := 1 + (Ln(0.5*Ln(RStop)) - Ln(0.5*Ln(Rout))) * LnC21d;
else
SmoothItD := ItResultI + (Ln(0.5*Ln(RStop)) - Ln(0.5*Ln(Rout))) / ln(ln(Rout)/ln(OldRout));
Using the actual divergence at bailout in this way is a lot more accurate.
Note that you can of course pre-calculate Ln(0.5*Ln(RStop)) - it's included because it's essential when using the calculated divergence.