Logo by AGUS - 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: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. September 19, 2021, 04:42:42 AM


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] 2 3 ... 5   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  (Read 4562 times)
0 Members and 1 Guest are viewing this topic.
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« on: November 14, 2015, 01:28:36 AM »

  Is there a decent coloring implementation?  I'm working on something to build onto.... but don't want to recreate the wheel.


  Never mind.   Found it cheesy
« Last Edit: November 14, 2015, 02:26:49 AM by M Benesi » Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #1 on: November 14, 2015, 02:28:18 PM »

Can you share? I am about to get nicely into that.
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #2 on: November 14, 2015, 08:02:41 PM »

Can you share? I am about to get nicely into that.
  I horde my toys, and taunt others with them from my ivory tower because I'm a greedy beautiful person.   :p

  So problem is, I was wrong when I said I found what I wanted.  A couple years ago, Kali implemented a coloring algorithm that worked for certain fractals... but it wasn't exactly what I wanted.

  The clunky one I made, that's also in that thread, was sort of what I want, but way to complex, not sure about the math in it, and slow on my ancient GPU (might work fine for you).  However, I wanted something more streamlined, so ended up adding something to the fast raytracer, and Kn2 .. which I'm working on. 

  I didn't do the math correctly, and I'm trying to fix it before I put it out here.
Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #3 on: November 14, 2015, 09:35:18 PM »

  Ok.  Done.  Fixed it a bit.   Needs a bit of clean up... and maybe a few more colors.  I'm going to look at other palette editing code for a more generalized palette generation scheme.  

  Add this code to your raytracer, replacing the existing getcolor() function, and adding the "palette" tab.  Maybe remove the old coloring scheme, since it... well. I don't know.  Keep it if you want.  I only put a couple colors in for now.  You can see how to add and balance them from the following.  It took me a while to figure out the extremely simple math to blend the colors.. for whatever reason I had problems with it.  

I'm thinking about adding in a sharp color option, so the color change is discrete, instead of smooth.  Ok.. did it...

UPDATED   Frags have "sharp" option added, and so does the code below.

ummm updated again... wanted to specify Sharp0to1, so people understand the range....  and changed the default preset in Mandelbulb.frag, and pine tree's lolcolors preset.

Code:


#group Palette
uniform bool paletteColoring; checkbox[true]
uniform vec3 pBaseColor;color[0,0,0]
uniform float BaseStrength;slider[0,.3,1]
//speed of palette cycling
uniform float cSpeed; slider[0,10.,50.00]
//palette offset...  rotates pallete so you can put colors where you want 'em
uniform float pOffset; slider[0,0,100]
uniform vec3 color0;color[0.95,0.83,0.42]  
uniform bool Sharp0to1;checkbox[false]
uniform float Dist0to1;slider[0,1,3]
uniform vec3 color1;color[1.,0.,0.07]
uniform bool Sharp1to2;checkbox[false]
uniform float Dist1to2;slider[0,1,3]
uniform vec3 color2;color[.7,.7,0.42]
uniform bool Sharp2to3;checkbox[false]
uniform float Dist2to3;slider[0,1,3]
uniform vec3 color3;color[1.,0.37,0.]
uniform bool Sharp3to0;checkbox[false]
uniform float Dist3to0;slider[0,1,3]

//uniform bool Orbit; checkbox[False]
uniform vec4 orbitStrengthXYZR;slider[(-3,-3,-3,-3),(1,1,1,1),(3,3,3,3)]

float PaletteCycleDistance=
(Dist0to1+Dist1to2+Dist2to3+Dist3to0);  
float dist01=Dist0to1/PaletteCycleDistance;
float dist12=Dist1to2/PaletteCycleDistance;
float dist23=Dist2to3/PaletteCycleDistance;
float dist30=Dist3to0/PaletteCycleDistance;
float cyclespeedadjusted=cSpeed*.1;
float poffset=pOffset/100.;

vec3 palette(vec4 p) {
float orbittotal=orbitStrengthXYZR.x*orbitTrap.x+
orbitStrengthXYZR.y*orbitTrap.y+
orbitStrengthXYZR.z*orbitTrap.z+
orbitStrengthXYZR.w*orbitTrap.w;

orbittotal=mod(abs(orbittotal)*cyclespeedadjusted,1.);
orbittotal=mod(orbittotal+poffset,1.);
vec3 colormix;
if (orbittotal<=dist01) {
if (Sharp0to1) {
colormix=mix(color0,pBaseColor,BaseStrength);
} else {
colormix=mix(color0,color1,abs(orbittotal)/(dist01));
colormix=mix(colormix,pBaseColor,BaseStrength);
}
} else if (orbittotal<=dist01+dist12) {
if (Sharp1to2) {
colormix=mix(color1,pBaseColor,BaseStrength);
} else {
colormix=mix(color1,color2,abs(orbittotal-dist01)/abs(dist12));
colormix=mix(colormix,pBaseColor,BaseStrength);
}
} else if (orbittotal<=dist01+dist12+dist23) {
if (Sharp2to3) {
colormix=mix(color2,pBaseColor,BaseStrength);
} else {
colormix=mix(color2,color3,abs(orbittotal-dist01-dist12)/abs(dist23));
colormix=mix(colormix,pBaseColor,BaseStrength);
}
} else {
if (Sharp3to0) {
colormix=mix(color3,pBaseColor,BaseStrength);
} else {
colormix=mix(color3,color0,abs(orbittotal-dist01-dist12-dist23)/abs(dist30));
colormix=mix(colormix,pBaseColor,BaseStrength);
}
}

return colormix;
}


vec3 getColor() {
vec3 orbitColor;
vec3 color;
if (paletteColoring) {
color = palette(orbitTrap);
} 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;
}
color = mix(BaseColor, 3.0*orbitColor,  OrbitStrength);
}
return color;
}


lol... colors:


* Fast-RaytracerPaletteColorTest.frag (12.3 KB - downloaded 73 times.)
* DE-Kn2exp.frag (32.22 KB - downloaded 74 times.)
* Mandelbulb.frag (5.59 KB - downloaded 82 times.)
* pine with good color.frag (10.63 KB - downloaded 72 times.)
« Last Edit: November 14, 2015, 10:45:56 PM by M Benesi » Logged

mclarekin
Fractal Senior
******
Posts: 1739



« Reply #4 on: November 14, 2015, 11:52:16 PM »

Very nice colouring.  Cool I want more control over coloring.  I did some simple experiments with two orbit traps, axis bias and color sampling from within the loop, but then got sidetracked by benesiMag, so I watch with interest  your developments. afro afro
Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #5 on: November 15, 2015, 01:49:14 AM »

The "niceness" of the coloring is due to the fractal formula... not the coloring formula... unfortunately.

 It's easy to color the T1 pinetree....  wink
Logged

Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #6 on: November 21, 2015, 08:49:57 PM »

M Benesi, thank you very much! This is nice color palette  smiley

Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #7 on: November 21, 2015, 11:10:05 PM »

Pretty! 

  We can save a few generalized presets for the formula as well... and if you want to add more colors to it.. wink
Logged

Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #8 on: November 30, 2015, 06:44:13 PM »

Really nice and simple for using! Much better than 'standard' orbittrap coloring.

Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #9 on: November 30, 2015, 07:38:58 PM »

  That looks cool, and it's not the coloring.  cheesy


   So... anyone else think of palette imports?  I have to find my old code for that so I don't have to figure it out from scratch again!  I'll find it.   You might like it.... 
Logged

3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #10 on: December 01, 2015, 03:01:50 AM »

something I fiddled with some time ago with interesting results wink
http://www.fractalforums.com/index.php?topic=16963.msg65092#msg65092

personally I like colors derived from math functions or representative of some mathematical aspect of the fractal, I think it lends character to the object, but palettes can be applied creatively too smiley
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #11 on: December 01, 2015, 07:31:21 AM »

   lol..  we need to add Domain Coloring to this.   I just grabbed a color swatch off the net to use as a palette for this image projection coloring scheme (added on to the palette one).  So.. that's even more of a palette... cheesy
  
  It doesn't work all that great with the bulb types...  so, I don't know how useful it will be in its current form.  I'm going to have to include options to pick single lines of the palette swatches and see how that works (hopefully a lot better.  cheesy).

  I set coloriterations pretty at 2 or 3 for the following. 

  Anyway, click these to enlarge.   @3Dickulus- Note that you need to build the system if you go full screen, and if you try to make a big render, it has no color, and you need to rebuild to see the object.  For whatever reason... it doesn't keep the texture loaded.

  




  Color swatch is here:

https://www.google.com/search?q=color+swatch&source=lnms&tbm=isch&sa=X&ved=0ahUKEwilgbfg3rnJAhUMl4gKHeCHD-gQ_AUIBygB&biw=1195&bih=623#tbm=isch&q=texture+colors&imgrc=c8Kw6vlS_SzGVM%3A



* Fast-Raytracer.frag (14.51 KB - downloaded 72 times.)
* MengerWorkOnStella.frag (6.36 KB - downloaded 73 times.)
« Last Edit: December 01, 2015, 07:53:25 AM by M Benesi » Logged

3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #12 on: December 01, 2015, 03:25:36 PM »

 afro looks good!

will look at full screen switch and texture persistence, as soon as this animation is done rendering wink
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #13 on: December 01, 2015, 06:10:56 PM »

animation!!!!!  cheesy
Logged

Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #14 on: December 01, 2015, 06:47:30 PM »

I painted amazing surface by Kali`s method   smiley not sure that is right code )
So i have more or less acceptable results with pseudo-kleinian


* a_surf-color-kali.jpg (71.24 KB, 700x450 - viewed 155 times.)
* a_surf-color-kali.bmp Files.zip (9.82 KB - downloaded 77 times.)
Logged

Pages: [1] 2 3 ... 5   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Image Coloring Help Images Showcase (Rate My Fractal) fractalwizz 9 1285 Last post October 21, 2008, 06:39:44 PM
by cKleinhuis
New Coloring Algorithm Images Showcase (Rate My Fractal) fractalwizz 1 1174 Last post November 06, 2008, 07:23:41 AM
by lycium
Gradient Coloring ! ManyFractals Gallery rickz65 0 855 Last post March 19, 2010, 10:22:31 PM
by rickz65
Coloring add-on Fragmentarium Kali 6 1827 Last post November 29, 2013, 08:57:39 AM
by SCORPION
Lyapunov With Joukowski-Dalinsky Coloring ChaosPro Gallery Kalter Rauch 0 606 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.139 seconds with 25 queries. (Pretty URLs adds 0.01s, 2q)