Welcome to Fractal Forums

Fractal Software => 3D Fractal Generation => Topic started by: G on December 21, 2010, 08:48:03 AM




Title: How do I colour a Mandelbox?
Post by: G on December 21, 2010, 08:48:03 AM
Hey guys,

So I'm currently writing a program to generate pictures via ray-tracing of the mandelbox by using the distance estimation formula. I was wondering if there was any algorithm that assigned unique/interesting colours to different parts of the Mandelbox. Presumably I would have to work off values of the distance from the screen. Is there any other way to do it?



Title: Re: How do I colour a Mandelbox?
Post by: Tglad on December 22, 2010, 01:13:59 AM
Like other 3d escape time fractals you can colour it based on the iteration count of the surface points. This is usually the nicest looking, but I can't give you the details because I forget how you do it exactly.
Another, similar way to colour is to keep a track of how much the point has expanded at the point you draw it (when the max iterations have expired).


Title: Re: How do I colour a Mandelbox?
Post by: cKleinhuis on December 22, 2010, 11:11:50 AM
another option is to just use the normalised 3 dimensional point as color ;)


Title: Re: How do I colour a Mandelbox?
Post by: Rrrola on December 24, 2010, 01:36:10 AM
Orbit trap: for all iterations, compute the distance from the origin. The color is the smallest distance from these. (It doesn't actually have to be the origin, of course.)


Title: Re: How do I colour a Mandelbox?
Post by: joeytwiddle on May 30, 2011, 08:29:43 PM
One interesting way to choose a colour is by counting the number of times each fold was applied during iteration.  Mandelbulber does this but combines all the counts into one value.

I experimented with building a colour out of the 3 fold counts like this:

Code:
//// Weight the colors because some folds occur more often than others
var multr = Math.pow(0.70, foldCounts.fixedSphere);
var multg = Math.pow(0.99, foldCounts.box);
var multb = Math.pow(0.60, foldCounts.minSphere);
//// Note these numbers get smaller with more iterations, so...

//// Normalise the result (find the ratio)
var maxMult = Math.max(Math.max(multr,multg),multb);
multr /= maxMult;
multg /= maxMult;
multb /= maxMult;

//// Apply lighting separately
data[ptr]   = lightness*multr;
data[ptr+1] = lightness*multg;
data[ptr+2] = lightness*multb;

So redness should correspond inversely to the number of fixedSphere folds, greenness to box folds, and blueness to minSphere folds.  The result is:

(http://img62.imageshack.us/img62/5996/screenshot18728.png) (http://imageshack.us/photo/my-images/62/screenshot18728.png/)

At higher iterations further variations on these colours can be found.  It seems unlikely we'll ever see pure red this way though!  ;)

The above combination generates somewhat pastel colours as you can see, but I found these reasonably good for picking out bumps with lighting.  But there are many other ways you could visualise the fold counts.

You can try out the application here (http://hwi.ath.cx/javascript/fractals/mandelbox.html) (Javascript - no WebGL).