Iteration Color _ Menger Sponge

  • 0 Replies
  • 107 Views

0 Members and 1 Guest are viewing this topic.

Offline mclarekin

  • *
  • Moderator
  • ******
  • Posts: 710
« on: March 21, 2019, 08:39:52 AM »
Iteration Color _ Menger Sponge

Many formulas have conditions in the code which can be used to derive color. There a several   if(  value < limit) type conditions within a Menger Sponge code. In this example I only use one of them (the best one :)). In the code below there is this condition   "if z.z is less a limit then add  an offset, otherwise do nothing"

Code: [Select]
if( z.z<-0.5*Offset.z)
{
  z.z += Offset.z;

we then use this for deriving some color, the simplest way is to do the same  "if z.z is less than something then add  a Color_Constant_Offset to the ColorValue, otherwise do nothing".  Adding a set constant is OK, but sometimes  we add a constant of transitioning value based on the distance to the limit.

the code below has a  bool ConditionTransition to switch between a set constant and a transitioning constant

Code: [Select]
if( z.z<-0.5*Offset.z)
{
  z.z += Offset.z;
if (ConditionTransition)
ColorAddCond += (z.z  + 0.5*Offset.z);
else ColorAddCond += 1.0;
}

 then later  we can modify the effect of this color input. In this case it is the code:  +(ColorAddCond * ConditionColor). ConditionColor being the weight or scale.

Code: [Select]
if ( rr>Bailout) break;

// color calculation
if (i<ColorIterations)
{
//old orig xyz "orbitTrap"
orbitTrap = min(orbitTrap, vec4(abs(z),rr));

//new color palette
ColorOrbit = min(ColorOrbit, rr) * orbitTrapColor;
ColorValue += ColorOrbit + (ColorAddCond * ConditionColor);
}

i++;
}



Linkback: https://fractalforums.org/color-snippets/78/iteration-color-menger-sponge/2711/
« Last Edit: March 24, 2019, 09:47:21 PM by 3DickUlus »


xx
menger sponge color 1

Started by mclarekin on Fractal Image Gallery

0 Replies
221 Views
Last post March 19, 2018, 04:18:28 AM
by mclarekin
xx
menger sponge color 2

Started by mclarekin on Fractal Image Gallery

0 Replies
191 Views
Last post March 19, 2018, 04:19:41 AM
by mclarekin
xx
Menger sponge

Started by ArtIco on Fractal Image Gallery

0 Replies
203 Views
Last post December 21, 2017, 11:33:39 AM
by ArtIco
clip
menger sponge 4D

Started by mclarekin on Code Snippets (fragments)

0 Replies
34 Views
Last post April 16, 2020, 02:40:15 PM
by mclarekin
xx
inverted Menger Sponge A

Started by mclarekin on Fractal Image Gallery

0 Replies
113 Views
Last post September 26, 2018, 11:20:53 AM
by mclarekin