|
|
abram wrote:
> The patch:
> http://softwareprocess.es/x/x/mandelbulb/fnintern.cpp.patch
Looking at it again, I can see a simple improvement that shouldn't cost
too much computing power and would make it much more usable for pigments
and media - returning smooth values based on rate of divergence.
No change needed on your if(cnt<=0){return -1.0;}, but what you can do
for the other condition is:
return (cnt+log(log(r)/log(2.0))/log(n))/(iterations);
In words: find the count you got down to, and add a fraction to it that
approximates how close it was to taking one less iteration, then
normalizing that so it will return a range from 0 to 1+, where 0 is when
you've reached nearly the max iterations, and 1+ when it takes only 1
iteration to diverge, and higher than that when it diverges really far
in the first step.
The actual formula for that fraction is log[base n](log[base
threshold](cnt)), where your threshold for the radius is 2.0.
This would let you get smoothly colored pigment patterns if you want to
do any rate of divergence coloring, which could be interesting. Of
course feel free to change the range of returned values, this is just an
idea for normalizing. To save very minor computational cost you can
pre-calculate the log(2.0), or even change your divergence radius to E.
Chris
Post a reply to this message
|
|