Title: Basic 3D Fractal Coloring Post by: asimes on March 06, 2012, 05:24:37 AM I've been trying to figure out how to render my 3D Fractals for a while now and cannot seem to make a good looking image. 2D fractals are more intuitive to me because I can come up with coloring techniques based on iterations. Right now for 3D I'm using a very basic distance estimation mixed with r, g, b color space.
In range of 0.0 to 1.0... - Basic distance estimation value = 0.5*sqrt(x*x+y*y+z*z) - RGB color cube: (0.5*abs(x), 0.5*abs(y), 0.5*abs(z)) Right now I am doing my point rendering as I test points to see if they are part of the fractal (in the same for loop as the point test if they reach the bailout). Is it normal to store the points that are part of the fractal for a post rendering? This seems somewhat unreasonable for larger images... even 800x800x800 results in a bounding box of half a billion voxels. The most obvious thing this is lacking is shadows I think, my basic distance estimation doesn't cut it. Renders so far result in images like this: (http://i.imgur.com/f8UGI.png) Note: This image was put into Photoshop for Auto Contrast and some brightness help as the distance estimation is not specific enough. Any advice on how to render fractal point clouds would be greatly appreciated. Title: Re: Basic 3D Fractal Coloring Post by: Mrz00m on March 06, 2012, 05:44:55 AM coloration formula depends on the fractal? if you look at the .cl files in mandelbulber 1.11 they have a color and colormin variable, it's only 20 line formulas.
example mandelbox: Code: int4 cond1, cond2; Title: Re: Basic 3D Fractal Coloring Post by: asimes on March 06, 2012, 06:06:29 AM If the formula is dependent on the fractal then I guess I would be most interested in learning one for either the Quadratic Mandelbulb or the power 8 Mandelbulb. I've never used Mandelbulber or tried to make a Mandelbox.
Title: Re: Basic 3D Fractal Coloring Post by: Mrz00m on March 06, 2012, 11:43:40 AM http://www.fractalforums.com/3d-fractal-generation/coloring-mandelbulb/msg43511/#msg43511
Title: Re: Basic 3D Fractal Coloring Post by: asimes on March 06, 2012, 06:07:32 PM Not totally sure if it is the same, but it looks like this line: distance = 0.5f * r * native_log(r) / (r_dz);
Is like this equation: distance estimation = 0.5 * |w| * log(|w|) / |δw| I found that equation from here: http://www.subblue.com/blog/2009/12/13/mandelbulb This is what I had in mind when I made my basic distance estimation. I don't know how to calculate a derivative so had to leave that part off. I can't use that code, I have a few questions about it: - What are all of those functions that have "native" in front of them? - What is fast_length? - What does r_dz initialize as? - What is colourMin's value? If you could just explain what the idea is behind the coloring method that would probably help me a lot more. My code for testing the points looks quite different from that and even if I know what all of the things were from the questions above it would be hard to make it work with my code. Title: Re: Basic 3D Fractal Coloring Post by: Mrz00m on March 06, 2012, 07:34:32 PM I dont have any idea how the coloring code works, i just had an example of the code so i thought that i would post it...
that code is all that is needed to make the mandelbulb, most of it is the mandelbulb formula, very little like 3 4 lines relates to the color. the fast length etc are open cl fast algorithm commands, here is a ref card http://www.khronos.org/files/opencl-1-1-quick-reference-card.pdf , although best to google the cl commands to see some more info on them. sorry i dunno the idea behind the code! fast length is a built in geometry function it's vector length. Title: Re: Basic 3D Fractal Coloring Post by: cKleinhuis on March 06, 2012, 10:28:40 PM basically you can use any form of coloring you like ... roughly you make the inside outside test, this makes basically a black/white image, coloring the inside black ...
this isnt nice for sure, in 2d mode you go and use the iteration-depth as colors ... but this is only beginning now to get incorporated, because in 3d it should have to be rendered in volume style manner, and rendering translucent volumes is somehow nast .... this leaves us to the color of the paint of the black object we just put in the middle of the screen ok, you could color it via: - abs(normalized(z))=rgb - apply some orbit trap orbit trap: apply a distance function - a function that makes out of a triplex input a single value - to current z triplex, use the lowest trap value as index for a colormap.... - side note: the orbit trap itself even make interesting objects!!! - keep in mind that any inside point has the same number of iterations as each other - try finding a nice inside coloring and adapt it to the triplex.... ;) and inform us about it .... - mapping images in 2d is easy, but harder in 3d to map on a fractal surface, but any combination of z's x/y/z party could be used as index for an image - perhaps containing a grdient or an image of yourself ;) Title: Re: Basic 3D Fractal Coloring Post by: asimes on March 07, 2012, 09:53:15 AM Very happy with the orbit trap method! Not perfect yet, is there a smoothing method or a more standard way of doing this? My method (in pseudo code):
Code: for (all of the points x, y, z) {This produces a range that is not between 0.0 - 1.0 unfortunately. I had to run the point testing and see what the biggest value of trapAverage was before I did my render (when rendering 1000x1000x1000 voxels the biggest value was about 1.3 something). What is going on if you don't want to read the pseudo code is: In a while loop... if the bailout is not hit... add the distance (radius) to trap... at the end of the loop divide trap by the number of iterations. Here is the result: (http://i.imgur.com/M8eS2.png) I will keep playing with other coloring methods. Any advice on orbit trapping would be appreciated. Title: Re: Basic 3D Fractal Coloring Post by: cKleinhuis on March 07, 2012, 10:03:22 AM btw, you can use basically ANY function as orbit trap, the length of the vector gives you a sphere, this sphere can be moved via an offset, you just use (0,0,0) as distance, put the distance function in a function ;) and use an offset to parametrize your distance function .... browse ultrafractal formulas for nice shapes, my favorite : http://en.wikipedia.org/wiki/Superformula and you are using the average, more variants are: max/min |