Logo by yv3 - 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: Visit us on facebook
 
*
Welcome, Guest. Please login or register. June 13, 2021, 02:01:42 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: Coloring add-on  (Read 1806 times)
0 Members and 1 Guest are viewing this topic.
Kali
Fractal Supremo
*****
Posts: 1138


« on: December 29, 2012, 05:32:38 PM »

Hi,

I wanted to share this simple add-on for Fragmentarium raytracer to easy coloring using a 3-color palette.

Put "ColorPalette.frag" inside "Examples\Include" folder, and use:
Code:
#include "ColorPalette.frag"
before the #include "raytracer.frag" statement in your fragment.

This works with "DE-Raytracer.frag", for other raytracers try with "ColorPalette2.frag".

You must implement "float Coloring(vec3 p)" function, where p are the hit coordinates. The returning float will be used as color index for cycling the three colors.
You may want to scale this value to work properly (or adjust ColorDensity range in the slider declaration).

Use OrbitStrength slider for mixing this coloring with BaseColor.

In the example (KboxExpSmooth.frag), I implemented exponential smoothing for coloring the Kalibox towers:



Hope you find it useful.

* ColorPalette.frag (0.9 KB - downloaded 191 times.)
* ColorPalette2.frag (0.9 KB - downloaded 183 times.)
* KboxExpSmooth.frag (2.8 KB - downloaded 195 times.)
« Last Edit: December 29, 2012, 05:58:52 PM by Kali » Logged

|</\|_|
░░░░░░░

http://fractkali.deviantart.com/
subblue
Conqueror
*******
Posts: 116



WWW
« Reply #1 on: December 30, 2012, 03:18:11 PM »

Neat. I've been playing with a similar thing using a gradient image lookup (sampled from an image in a circle to create a seamless colour loop).

One thing I've found when playing with colouring modes like this where the final index is related to the iteration point distance from the origin is that when the colour iteration count nears the fractal iterations then the colouring changes based on the view direction. I always limit the max colour iterations to a few less that the fractal iteration count.

Just thinking about it there, maybe by only adding to the colour index count when the difference between the current and previous point is above a threshold might help.
Logged

www.subblue.com - a blog exploring mathematical and generative graphics
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #2 on: December 31, 2012, 09:59:33 PM »

  looks way tighter than my extended coloring script that I put in a few scripts.  I ended up choosing 6 colors, with varying speeds between the RGB values, set by the script:

Code:
#group Palette
uniform bool paletteColoring; checkbox[true]
uniform float orbitSpeedNumerator;slider[-10,1,10]
uniform float orbitSpeedDivisor;slider[.1,2,10]
uniform float colorSpeedNumerator;slider[1,2,10]
uniform float colorSpeedDivisor;slider[.1,2,10]
uniform float paletteRotations; slider[-10,0,10]
uniform float paletteRotationSpeed; slider[-1.00,0.11,1.00]

uniform int orbitMode; slider[1,1,2]
uniform int colorFunction; slider[0,0,4]
//slider[(0,0,0),(222,33,44),(255,255,255)]
 //
uniform vec3 rgb0; color[0.5,0.6,0.6];
uniform vec3 Drgb1; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb1; color[0.5,0.6,0.6];
uniform vec3 Drgb2;  slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb2; color[0.5,0.6,0.6];
uniform vec3 Drgb3; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb3; color[0.5,0.6,0.6];
uniform vec3 Drgb4; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb4;color[0.5,0.6,0.6];
uniform vec3 Drgb5; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb5; color[0.5,0.6,0.6];
uniform vec3 Drgb0; slider[(0,0,0),(5,5,5),(20,20,20)]

uniform bool Orbit; checkbox[False]

uniform vec3 orbitStrengthXYZ;slider[(0,0,0),(1,1,1),(2,2,2)]

float Dred=Drgb1.x+Drgb2.x+Drgb3.x+Drgb4.x+Drgb5.x+Drgb0.x;
float Dgreen=Drgb1.y+Drgb2.y+Drgb3.y+Drgb4.y+Drgb5.y+Drgb0.y;
float Dblue=Drgb1.z+Drgb2.z+Drgb3.z+Drgb4.z+Drgb5.z+Drgb0.z;
float Dtot=(Dred+Dgreen+Dblue)/3.; 
vec3 palette(vec3 c, float s) {
//return vec3(0.5)+0.5*vec3(cos(s*Cycles+c.x),cos(s*Cycles+c.y),cos(s*Cycles+c.z));
//orbitTrap*=orbitSpeed;
//float lp=mod(length(orbitTrap),Dtot);
float lp;
float reddist;
float greendist;
float bluedist;
float CSpN=colorSpeedNumerator+time*time4;
if (Orbit) {
reddist=mod(orbitTrap.x*orbitStrengthXYZ.x+
orbitTrap.y*orbitStrengthXYZ.y+
orbitTrap.z*orbitStrengthXYZ.z   ,Dred);
greendist=mod(orbitTrap.x*orbitStrengthXYZ.x+
orbitTrap.y*orbitStrengthXYZ.y+
orbitTrap.z*orbitStrengthXYZ.z   ,Dgreen);
bluedist=mod(orbitTrap.x*orbitStrengthXYZ.x+
orbitTrap.y*orbitStrengthXYZ.y+
orbitTrap.z*orbitStrengthXYZ.z   ,Dblue);
} else {
if (colorFunction==0) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
lp=mod(lp,Dtot*3.);   
reddist=mod(Dred/Dtot*3.*lp*CSpN/colorSpeedDivisor,Dred);
greendist=mod(lp*Dgreen/Dtot*3.*CSpN/colorSpeedDivisor,Dgreen);
bluedist=mod(lp*Dblue/Dtot*3.*CSpN/colorSpeedDivisor,Dblue);
} else if (colorFunction==1) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
lp=mod(lp,Dtot*3.);   
reddist=(Dred/Dtot*3.*lp*CSpN/colorSpeedDivisor);
greendist=(lp*Dgreen/Dtot*3.*CSpN/colorSpeedDivisor);
bluedist=(lp*Dblue/Dtot*3.*CSpN/colorSpeedDivisor);
} else if (colorFunction==2) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
reddist=mod(lp,Dred)*CSpN/colorSpeedDivisor;
greendist=mod(lp,(Dgreen))*CSpN/colorSpeedDivisor;
bluedist=mod(lp,(Dblue))*CSpN/colorSpeedDivisor;
} else if (colorFunction==3) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
lp=mod(lp,Dtot*3.);       //maybe this instead
reddist=(lp-Dgreen-Dblue)*CSpN/colorSpeedDivisor;
greendist=(lp-Dred-Dblue)*CSpN/colorSpeedDivisor;
bluedist=(lp-Dgreen-Dred)*CSpN/colorSpeedDivisor; 
} else {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
reddist=mod((lp-Dgreen-Dblue)*CSpN/colorSpeedDivisor,Dred);
greendist=mod((lp-Dred-Dblue)*CSpN/colorSpeedDivisor,Dgreen);
bluedist=mod((lp-Dgreen-Dred)*CSpN/colorSpeedDivisor,Dblue);
}
}
if (paletteRotations+time*time5!=0.) {
reddist=mod(reddist+Dred*(paletteRotations*paletteRotationSpeed),Dred);
greendist=mod(greendist+Dgreen*(paletteRotations*paletteRotationSpeed),Dgreen);
bluedist=mod(bluedist+Dblue*(paletteRotations*paletteRotationSpeed),Dblue);
}
float redpart=1.;
float greenpart=1.;
float bluepart=1.;
if (reddist<=Drgb1.x) {
redpart=reddist;
redpart*=(rgb1.x-rgb0.x)/Drgb1.x;
redpart+=rgb0.x;
} else if (reddist<=Drgb1.x+Drgb2.x) {
redpart=reddist-Drgb1.x;
redpart*=(rgb2.x-rgb1.x)/Drgb2.x;
redpart+=rgb1.x;
} else if (reddist<=Drgb1.x+Drgb2.x+Drgb3.x) {
redpart=reddist-Drgb2.x-Drgb1.x;
redpart*=(rgb3.x-rgb2.x)/Drgb3.x;
redpart+=rgb2.x;
} else if (reddist<=Dred-Drgb5.x) {
redpart=reddist-Drgb3.x-Drgb2.x-Drgb1.x;
redpart*=(rgb4.x-rgb3.x)/Drgb4.x;
redpart+=rgb3.x;
} else if (reddist<Dred-Drgb0.x) {
redpart=reddist-Drgb4.x-Drgb3.x-Drgb2.x-Drgb1.x;
redpart*=(rgb5.x-rgb4.x)/Drgb5.x;
redpart+=rgb4.x;
} else if (reddist<Dred) {   
redpart=reddist-Dred+Drgb0.x;
redpart*=(rgb0.x-rgb5.x)/Drgb0.x;
redpart+=rgb5.x;
}
if (greendist<=Drgb1.y) {
greenpart=greendist;
greenpart*=(rgb1.y-rgb0.y)/Drgb1.y;
greenpart+=rgb0.y;

} else if (greendist<=Drgb1.y+Drgb2.y) {
greenpart=greendist-Drgb1.y;
greenpart*=(rgb2.y-rgb1.y)/Drgb2.y;
greenpart+=rgb1.y;

} else if (greendist<=Drgb1.y+Drgb2.y+Drgb3.y) {
greenpart=greendist-Drgb2.y-Drgb1.y;
greenpart*=(rgb3.y-rgb2.y)/Drgb3.y;
greenpart+=rgb2.y;

} else if (greendist<=Drgb1.y+Drgb2.y+Drgb3.y+Drgb4.y) {
greenpart=greendist-Drgb3.y-Drgb2.y-Drgb1.y;
greenpart*=(rgb4.y-rgb3.y)/Drgb4.y;
greenpart+=rgb3.y;

} else if (greendist<=Dgreen-Drgb0.y) {
greenpart=greendist-Drgb4.y-Drgb3.y-Drgb2.y-Drgb1.y;
greenpart*=(rgb5.y-rgb4.y)/Drgb5.y;
greenpart+=rgb4.y;

} else if (greendist<=Dgreen) {
greenpart=greendist-Dgreen+Drgb0.y;
greenpart*=(rgb0.y-rgb5.y)/Drgb0.y;
greenpart+=rgb5.y;

}

if (bluedist<=Drgb1.z) {
bluepart=bluedist;
bluepart*=(rgb1.z-rgb0.z)/Drgb1.z;
bluepart+=rgb0.z;
} else if (bluedist<=Drgb1.z+Drgb2.z) {
bluepart=bluedist-Drgb1.z;
bluepart*=(rgb2.z-rgb1.z)/Drgb2.z;
bluepart+=rgb1.z;
} else if (bluedist<=Drgb1.z+Drgb2.z+Drgb3.z) {
bluepart=bluedist-Drgb2.z-Drgb1.z;
bluepart*=(rgb3.z-rgb2.z)/Drgb3.z;
bluepart+=rgb2.z;
} else if (bluedist<=Drgb1.z+Drgb2.z+Drgb3.z+Drgb4.z) {
bluepart=bluedist-Drgb3.z-Drgb2.z-Drgb1.z;
bluepart*=(rgb4.z-rgb3.z)/Drgb4.z;
bluepart+=rgb3.z;
} else if (bluedist<=Dblue-Drgb0.z) {
bluepart=bluedist-Drgb4.z-Drgb3.z-Drgb2.z-Drgb1.z;
bluepart*=(rgb5.z-rgb4.z)/Drgb5.z;
bluepart+=rgb4.z;
} else if (bluedist<Dblue) {
bluepart=bluedist-Dblue+Drgb0.z;
bluepart*=(rgb0.z-rgb4.z)/Drgb0.z;
bluepart+=rgb5.z;
}

return vec3(redpart,greenpart,bluepart);
//return vec3 (redpart/255.,greenpart/255.,bluepart/255.);
//return vec3 (255/255.,255/255.,255/255.);
}

vec3 cycle(vec3 c, float s) {
return vec3(0.5)+0.5*vec3(cos(s*Cycles+c.x),cos(s*Cycles+c.y),cos(s*Cycles+c.z));
}

vec3 color(vec3 p) {
//orbitTrap = vec4(1.0);
inside(p);

orbitTrap.w = sqrt(orbitTrap.w);
vec3 orbitColor;
if (paletteColoring) {
orbitColor = palette(orbitTrap.xyz,orbitTrap.w);

} else if (CycleColors) {
orbitColor = cycle(X.xyz,orbitTrap.x)*X.w*orbitTrap.x +
cycle(Y.xyz,orbitTrap.y)*Y.w*orbitTrap.y +
cycle(Z.xyz,orbitTrap.z)*Z.w*orbitTrap.z +
cycle(R.xyz,orbitTrap.w)*R.w*orbitTrap.w;
} else {
orbitColor = X.xyz*X.w*orbitTrap.x +
Y.xyz*Y.w*orbitTrap.y +
Z.xyz*Z.w*orbitTrap.z +
R.xyz*R.w*orbitTrap.w;
}

//vec3 color = mix(BaseColor, 3.0*orbitColor,  OrbitStrength);
return orbitColor;

}
Logged

SCORPION
Conqueror
*******
Posts: 104


« Reply #3 on: November 12, 2013, 03:29:18 AM »

Kali, it works! Experimented on Mandelbulb.frag and PseudoKleinian.frag.
Thank you!
M Benesi, wanted to try either option, but I can not put in your code. I really do not know much programming. Could you explain in detail how to turn your code? And to turn it on? Alone or in code DE raytracer?
Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #4 on: November 17, 2013, 02:21:05 AM »

  Hey- 

  A quick note on the coloring code above: It never was a really good implementation of coloring code.  It's a pain in the ass to use (compared to ChaosPro's coloring engine), and I never got around to fixing it up. 

  I was leaning towards doing something along the lines of ChaosPro's coloring design tools (more or less doing a rough copy), but I never got around to finishing it- got caught up in other things.

  I'm not entirely sure that I feel like getting back into coding fractals at this point in time.  I'm wondering if someone made an improvement on the front end, or designed a better coloring implementation while I've been away?  I haven't been here on the forums for quite some time- so I'd start a new thread, and ask about coloring implementations in fragmentarium.



  As to using the code itself (which isn't that great- I'm pretty sure Kali made a few cooler coloring engines than this one before I wandered away from the forums):

  I think I cut and paste the coloring code into various formulas that already exist for fragmentarium.  I'd look for similar function calls (vec3 XXXXX, #group Palette, etc...) and try replacing them, or at least integrating the parts of the code that define colors. 


  Good Luck,

  Benesi
Logged

SCORPION
Conqueror
*******
Posts: 104


« Reply #5 on: November 24, 2013, 03:24:55 AM »

And I like your work!
But I can not run your script with "DE-raytracer." A "Brute-raytracer" I do not like. If you help me to adapt your code to "DE raytracer"
I will be very grateful to you.

Here is my result with "Brute-raytracer, I am quite pleased:

Code:
#info Mandelbulb Color
#define providesColor
#include "Brute-Raytracer.frag"
#include "MathUtils.frag"

#group Mandelbulb

uniform float Bailout;slider[0.0,0.1,2.0]
uniform float Power;slider[0.0,5,30]
uniform float Iterations;slider[0.0,10,100]
uniform int ColorIterations;  slider[0,9,100]
uniform int ColorIterationsMin;  slider[0,1,100]
uniform bool SphereInv; checkbox[false]
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]

uniform float time;


#group Palette
uniform bool paletteColoring; checkbox[true]
uniform float orbitSpeedNumerator;slider[-10,1,10]
uniform float orbitSpeedDivisor;slider[.1,2,10]
uniform float colorSpeedNumerator;slider[1,2,10]
uniform float colorSpeedDivisor;slider[.1,2,10]
uniform float paletteRotations; slider[-10,0,10]
uniform float paletteRotationSpeed; slider[-1.00,0.11,1.00]
uniform int orbitMode; slider[1,1,2]
uniform int colorFunction; slider[0,0,4]
uniform vec3 rgb0; color[0.5,0.6,0.6];
uniform vec3 Drgb1; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb1; color[0.5,0.6,0.6];
uniform vec3 Drgb2;  slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb2; color[0.5,0.6,0.6];
uniform vec3 Drgb3; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb3; color[0.5,0.6,0.6];
uniform vec3 Drgb4; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb4;color[0.5,0.6,0.6];
uniform vec3 Drgb5; slider[(0,0,0),(5,5,5),(20,20,20)]
uniform vec3 rgb5; color[0.5,0.6,0.6];
uniform vec3 Drgb0; slider[(0,0,0),(5,5,5),(20,20,20)]

uniform bool Orbit; checkbox[False]

uniform vec3 orbitStrengthXYZ;slider[(0,0,0),(1,1,1),(2,2,2)]

float Dred=Drgb1.x+Drgb2.x+Drgb3.x+Drgb4.x+Drgb5.x+Drgb0.x;
float Dgreen=Drgb1.y+Drgb2.y+Drgb3.y+Drgb4.y+Drgb5.y+Drgb0.y;
float Dblue=Drgb1.z+Drgb2.z+Drgb3.z+Drgb4.z+Drgb5.z+Drgb0.z;
float Dtot=(Dred+Dgreen+Dblue)/3.; 
vec3 palette(vec3 c, float s) {

float lp;
float reddist;
float greendist;
float bluedist;
float CSpN=colorSpeedNumerator+time;
if (Orbit) {
reddist=mod(orbitTrap.x*orbitStrengthXYZ.x+
orbitTrap.y*orbitStrengthXYZ.y+
orbitTrap.z*orbitStrengthXYZ.z   ,Dred);
greendist=mod(orbitTrap.x*orbitStrengthXYZ.x+
orbitTrap.y*orbitStrengthXYZ.y+
orbitTrap.z*orbitStrengthXYZ.z   ,Dgreen);
bluedist=mod(orbitTrap.x*orbitStrengthXYZ.x+
orbitTrap.y*orbitStrengthXYZ.y+
orbitTrap.z*orbitStrengthXYZ.z   ,Dblue);
} else {
if (colorFunction==0) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
lp=mod(lp,Dtot*3.);   
reddist=mod(Dred/Dtot*3.*lp*CSpN/colorSpeedDivisor,Dred);
greendist=mod(lp*Dgreen/Dtot*3.*CSpN/colorSpeedDivisor,Dgreen);
bluedist=mod(lp*Dblue/Dtot*3.*CSpN/colorSpeedDivisor,Dblue);
} else if (colorFunction==1) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
lp=mod(lp,Dtot*3.);   
reddist=(Dred/Dtot*3.*lp*CSpN/colorSpeedDivisor);
greendist=(lp*Dgreen/Dtot*3.*CSpN/colorSpeedDivisor);
bluedist=(lp*Dblue/Dtot*3.*CSpN/colorSpeedDivisor);
} else if (colorFunction==2) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
reddist=mod(lp,Dred)*CSpN/colorSpeedDivisor;
greendist=mod(lp,(Dgreen))*CSpN/colorSpeedDivisor;
bluedist=mod(lp,(Dblue))*CSpN/colorSpeedDivisor;
} else if (colorFunction==3) {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
lp=mod(lp,Dtot*3.);       //maybe this instead
reddist=(lp-Dgreen-Dblue)*CSpN/colorSpeedDivisor;
greendist=(lp-Dred-Dblue)*CSpN/colorSpeedDivisor;
bluedist=(lp-Dgreen-Dred)*CSpN/colorSpeedDivisor; 
} else {
lp=length(orbitTrap.xyz)*orbitSpeedNumerator/orbitSpeedDivisor;
reddist=mod((lp-Dgreen-Dblue)*CSpN/colorSpeedDivisor,Dred);
greendist=mod((lp-Dred-Dblue)*CSpN/colorSpeedDivisor,Dgreen);
bluedist=mod((lp-Dgreen-Dred)*CSpN/colorSpeedDivisor,Dblue);
}
}
if (paletteRotations+time) {
reddist=mod(reddist+Dred*(paletteRotations*paletteRotationSpeed),Dred);
greendist=mod(greendist+Dgreen*(paletteRotations*paletteRotationSpeed),Dgreen);
bluedist=mod(bluedist+Dblue*(paletteRotations*paletteRotationSpeed),Dblue);
}
float redpart=1.;
float greenpart=1.;
float bluepart=1.;
if (reddist<=Drgb1.x) {
redpart=reddist;
redpart*=(rgb1.x-rgb0.x)/Drgb1.x;
redpart+=rgb0.x;
} else if (reddist<=Drgb1.x+Drgb2.x) {
redpart=reddist-Drgb1.x;
redpart*=(rgb2.x-rgb1.x)/Drgb2.x;
redpart+=rgb1.x;
} else if (reddist<=Drgb1.x+Drgb2.x+Drgb3.x) {
redpart=reddist-Drgb2.x-Drgb1.x;
redpart*=(rgb3.x-rgb2.x)/Drgb3.x;
redpart+=rgb2.x;
} else if (reddist<=Dred-Drgb5.x) {
redpart=reddist-Drgb3.x-Drgb2.x-Drgb1.x;
redpart*=(rgb4.x-rgb3.x)/Drgb4.x;
redpart+=rgb3.x;
} else if (reddist<Dred-Drgb0.x) {
redpart=reddist-Drgb4.x-Drgb3.x-Drgb2.x-Drgb1.x;
redpart*=(rgb5.x-rgb4.x)/Drgb5.x;
redpart+=rgb4.x;
} else if (reddist<Dred) {   
redpart=reddist-Dred+Drgb0.x;
redpart*=(rgb0.x-rgb5.x)/Drgb0.x;
redpart+=rgb5.x;
}
if (greendist<=Drgb1.y) {
greenpart=greendist;
greenpart*=(rgb1.y-rgb0.y)/Drgb1.y;
greenpart+=rgb0.y;

} else if (greendist<=Drgb1.y+Drgb2.y) {
greenpart=greendist-Drgb1.y;
greenpart*=(rgb2.y-rgb1.y)/Drgb2.y;
greenpart+=rgb1.y;

} else if (greendist<=Drgb1.y+Drgb2.y+Drgb3.y) {
greenpart=greendist-Drgb2.y-Drgb1.y;
greenpart*=(rgb3.y-rgb2.y)/Drgb3.y;
greenpart+=rgb2.y;

} else if (greendist<=Drgb1.y+Drgb2.y+Drgb3.y+Drgb4.y) {
greenpart=greendist-Drgb3.y-Drgb2.y-Drgb1.y;
greenpart*=(rgb4.y-rgb3.y)/Drgb4.y;
greenpart+=rgb3.y;

} else if (greendist<=Dgreen-Drgb0.y) {
greenpart=greendist-Drgb4.y-Drgb3.y-Drgb2.y-Drgb1.y;
greenpart*=(rgb5.y-rgb4.y)/Drgb5.y;
greenpart+=rgb4.y;

} else if (greendist<=Dgreen) {
greenpart=greendist-Dgreen+Drgb0.y;
greenpart*=(rgb0.y-rgb5.y)/Drgb0.y;
greenpart+=rgb5.y;

}

if (bluedist<=Drgb1.z) {
bluepart=bluedist;
bluepart*=(rgb1.z-rgb0.z)/Drgb1.z;
bluepart+=rgb0.z;
} else if (bluedist<=Drgb1.z+Drgb2.z) {
bluepart=bluedist-Drgb1.z;
bluepart*=(rgb2.z-rgb1.z)/Drgb2.z;
bluepart+=rgb1.z;
} else if (bluedist<=Drgb1.z+Drgb2.z+Drgb3.z) {
bluepart=bluedist-Drgb2.z-Drgb1.z;
bluepart*=(rgb3.z-rgb2.z)/Drgb3.z;
bluepart+=rgb2.z;
} else if (bluedist<=Drgb1.z+Drgb2.z+Drgb3.z+Drgb4.z) {
bluepart=bluedist-Drgb3.z-Drgb2.z-Drgb1.z;
bluepart*=(rgb4.z-rgb3.z)/Drgb4.z;
bluepart+=rgb3.z;
} else if (bluedist<=Dblue-Drgb0.z) {
bluepart=bluedist-Drgb4.z-Drgb3.z-Drgb2.z-Drgb1.z;
bluepart*=(rgb5.z-rgb4.z)/Drgb5.z;
bluepart+=rgb4.z;
} else if (bluedist<Dblue) {
bluepart=bluedist-Dblue+Drgb0.z;
bluepart*=(rgb0.z-rgb4.z)/Drgb0.z;
bluepart+=rgb5.z;
}

return vec3(redpart,greenpart,bluepart);

}

vec3 cycle(vec3 c, float s) {
return vec3(0.5)+0.5*vec3(cos(s*Cycles+c.x),cos(s*Cycles+c.y),cos(s*Cycles+c.z));
}

vec3 color(vec3 p) {
//orbitTrap = vec4(1.0);
inside(p);

orbitTrap.w = sqrt(orbitTrap.w);
vec3 orbitColor;
if (paletteColoring) {
orbitColor = palette(orbitTrap.xyz,orbitTrap.w);

} else if (CycleColors) {
orbitColor = cycle(X.xyz,orbitTrap.x)*X.w*orbitTrap.x +
cycle(Y.xyz,orbitTrap.y)*Y.w*orbitTrap.y +
cycle(Z.xyz,orbitTrap.z)*Z.w*orbitTrap.z +
cycle(R.xyz,orbitTrap.w)*R.w*orbitTrap.w;
} else {
orbitColor = X.xyz*X.w*orbitTrap.x +
Y.xyz*Y.w*orbitTrap.y +
Z.xyz*Z.w*orbitTrap.z +
R.xyz*R.w*orbitTrap.w;
}


return orbitColor;

}

mat3 rot;

float DE(vec3 pos) {
vec3 z = pos;
float dr = 1.0;
float r = 0.0;
       if (SphereInv) z/=dot(z,z);
      for (int i = 0; i < Iterations ; i++) {
r = length(z);
      if (r>Bailout) break; 

// convert to polar coordinates
float theta = acos(z.z/r);
float phi = atan(z.y,z.x);
dr =  pow( r, Power-1.0)*Power*dr + 1.0;

// scale and rotate the point
float zr = pow( r,Power);
theta = theta*Power;
phi = phi*Power;
mat3 rot;

             rot = rotationMatrix3(normalize(RotVector), RotAngle);

// convert back to cartesian coordinates
z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
       z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
            if (i>ColorIterationsMin && i<ColorIterations) {

            if (orbitMode==1) {
orbitTrap=vec4(sqrt(z.x*z.x/orbitTrap.x*orbitTrap.x),
sqrt(z.y*z.y/orbitTrap.y*orbitTrap.y),
sqrt(z.z*z.z/orbitTrap.z*orbitTrap.z),
sqrt(dot(z,z)/orbitTrap.w*orbitTrap.w));
} else {
orbitTrap=min(orbitTrap,vec4(z.x*z.x,z.y*z.y,z.z*z.z,dot(z,z)));
}
}

}
return 0.5*log(r)*r/dr;
}



#preset Default
FOV = 0.20168
Eye = 1.63337,-3.8564,3.46416
Target = -0.456897,1.16098,-0.963312
EquiRectangular = false
Gamma = 1.15385
Exposure = 1.05318
Brightness = 0.8989
Contrast = 1.3402
Saturation = 1.0674
SpecularExp = 27.451
SpotLight = 1,1,1,0.4
SpotLightDir = 0.2,-0.1
CamLight = 1,1,1,0.875
CamLightMin = 0.53226
Fog = 0.07692
BaseColor = 1,1,1
OrbitStrength = 1
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 0.6,0.6,0.45
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
ToneMapping = 1
NormalScale = 0.98765
AOScale = 0.65655
Glow = 0.16379
AOStrength = 1
Samples = 1807
Stratify = true
DebugInside = false
CentralDifferences = true
SampleNeighbors = true
Near = 0
Far = 10.678
ShowDepth = false
DebugNormals = false
Specular = 10
paletteColoring = true
orbitSpeedNumerator = 10
orbitSpeedDivisor = 0.32503
colorSpeedNumerator = 8.49997
colorSpeedDivisor = 7.92793
paletteRotations = 8.1818
paletteRotationSpeed = 0.28
orbitMode = 1
colorFunction = 0
rgb0 = 0,0.333333,1
Drgb1 = 11.1112,15.9596,9.495
rgb1 = 1,0,0
Drgb2 = 12.1212,12.3232,10.909
rgb2 = 1,1,0
Drgb3 = 8.2828,13.9394,8.8888
rgb3 = 0,0.666667,0
Drgb4 = 7.0708,5,5
rgb4 = 0.333333,0,0
Drgb5 = 8.4848,5,4.8484
rgb5 = 0,0,0
Drgb0 = 7.8788,8.8888,8.8888
Orbit = false
orbitStrengthXYZ = 1.2,1.15,1.7
Bailout = 1.40186
Power = 10.4853
Iterations = 56.25
ColorIterations = 2
SphereInv = false
Julia = false
JuliaC = -0.57944,-0.46728,-0.31776
RotVector = 1,1,1
RotAngle = 0
Up = 0.00844108,0.999729,0.0216888
#endpreset
Logged
SCORPION
Conqueror
*******
Posts: 104


« Reply #6 on: November 29, 2013, 08:57:39 AM »

Sorted out the problem yourself!
Thank you all for your help!)))))
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
A new look into escapetime fractals using abs & inner coloring (new) Theories & Research « 1 2 » Kali 18 2460 Last post October 23, 2012, 05:48:56 PM
by Alef
Multiwave coloring for Mandelbrot UltraFractal « 1 2 3 » Pauldelbrot 31 8090 Last post September 17, 2014, 08:07:10 PM
by quaz0r
What's coloring you prefer (for M-Set) Help & Support SeryZone 7 249 Last post May 04, 2014, 08:44:57 AM
by SeryZone
Coloring Fragmentarium « 1 2 3 4 5 » M Benesi 68 4480 Last post April 18, 2016, 08:31:51 PM
by Crist-JRoger
Lyapunov With Joukowski-Dalinsky Coloring ChaosPro Gallery Kalter Rauch 0 567 Last post August 11, 2017, 05:09:20 AM
by Kalter Rauch

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.115 seconds with 26 queries. (Pretty URLs adds 0.007s, 2q)