Logo by chaos_crystal - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 18, 2024, 06:30:53 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Basic 3D Fractal Coloring  (Read 7800 times)
0 Members and 2 Guests are viewing this topic.
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« 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:



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.
« Last Edit: March 06, 2012, 06:35:48 AM by asimes » Logged
Mrz00m
Fractal Lover
**
Posts: 204


« Reply #1 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;

z.w = 0.0;
cond1 = isgreater(z, foldingLimit);
cond2 = isless(z, -foldingLimit);
z = select(z,  foldingValue - z, cond1);
z = select(z,  -foldingValue - z, cond2);

//z = fabs(z + ones) - fabs(z - ones) - z;

float rr = dot(z,z);
float m = scale;
if (rr < mr2) m = native_divide(scale, mr2);
else if (rr < fr2) m = native_divide(scale,rr);

z = Matrix33MulFloat3(fr->mandelbox.mainRot, z);

z = z * m + c;
tgladDE = tgladDE * fabs(m) + 1.0f;
r = dot(z,z);

colourMin += fabs(m);

if(r>1024.0f)
{
distance = native_sqrt(r) / fabs(tgladDE);
out.colourIndex = colourMin / i * 300.0;
break;
}
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #2 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.
Logged
Mrz00m
Fractal Lover
**
Posts: 204


« Reply #3 on: March 06, 2012, 11:43:40 AM »

http://www.fractalforums.com/3d-fractal-generation/coloring-mandelbulb/msg43511/#msg43511
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #4 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.
Logged
Mrz00m
Fractal Lover
**
Posts: 204


« Reply #5 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.

Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #6 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.... wink 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 wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #7 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) {
  float trap = 0;
  while (number of iterations < max iterations) {
    float rad = pow(sqrt(x*x+y*y+z*z), power);
    if (bailout) break;
    trap += rad;
  }
  if (number of iterations == max iterations) {
    float trapAverage = trap/n;
  }
}

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:



I will keep playing with other coloring methods. Any advice on orbit trapping would be appreciated.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #8 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 wink 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
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Ultra Fractal Coloring Converter Help & Support fractalwizz 9 1643 Last post October 22, 2008, 03:41:00 PM
by David Makin
Auto Log Fractal coloring Help & Support fractalwizz 13 3158 Last post January 05, 2009, 11:56:37 PM
by HPDZ
Anyone still use Basic? Programming Cyclops 10 5542 Last post September 27, 2010, 01:29:42 PM
by Nahee_Enterprises
Kaliset 3D fractal used as coloring & texture for DE systems 3D Fractal Generation « 1 2 » Kali 17 12718 Last post September 14, 2015, 03:57:37 PM
by Crist-JRoger
Basic Mandelbrot question: out-coloring modes General Discussion tobiles 2 7060 Last post October 30, 2014, 07:44:31 PM
by SeryZone

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.226 seconds with 27 queries. (Pretty URLs adds 0.008s, 2q)