PDA

View Full Version : Help with fractals

Felipe Ruiz
05-06-2010, 08:20 PM
So, like I said on my previous post, I'm trying to make Julia's Set using openGL. The big issue I'm having is getting the fractal colored.

I can get it in black and white and even grayscale, but I can't get something like this:

I'm using the escape time algorithm, but my problem is how to setup glColor3f() to get something like that...Can anyone help me?

05-06-2010, 09:03 PM
base the colors on the number of iterations..

try something like

if(iterations> maxiterations/8)
glColor3f(some color);
else if(iterations> maxiterations/6)
glColor3f(some color);
.....

Felipe Ruiz
05-06-2010, 09:43 PM
But isn't this almost like manual? There's no actual formula or something that can make it easier? I mean, there's no way of doing something like

glColor3f = f(iterations);or
glColor3b = f(iterations);
Where f is some sort of polynomial or crazy function?

Also, I'm trying to use GLUI_Spinners to change the colors, so I don't think that I could make it look nice like this. xD

05-06-2010, 10:08 PM
glColor3f() takes in 3 arguments... as far as i know there's no other way to go about it.. and yes you have to assign the colors manually but the loop isn't that hard to figure out..you've got like 8 colors in that image...start out with putting all those colors in an iteration range and work your way from the results you get...fractal set images change colors based on iterations and the set range

you can do glColor3f(f(r),f(g),f(b))
but you'd have to come up with functions that work out individual rgb components that match you requirements...which is imo very hard to do

goodluck
Raza

randall
05-07-2010, 02:11 AM
Use 1D texture with colors generated in GIMP or Photoshop or whatever. Use grayscale value you get as a texture coordinate.