### Iteration Color _ Menger Sponge

• 0 Replies
• 85 Views

0 Members and 1 Guest are viewing this topic.

• Moderator
• Posts: 654

#### Iteration Color _ Menger Sponge

« 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++; }

« Last Edit: March 24, 2019, 09:47:21 PM by 3DickUlus »

### Similar Topics

###### menger sponge color 1

Started by mclarekin on Fractal Image Gallery

0 Replies
204 Views
March 19, 2018, 04:18:28 AM
by mclarekin
###### menger sponge color 2

Started by mclarekin on Fractal Image Gallery

0 Replies
177 Views
March 19, 2018, 04:19:41 AM
by mclarekin
###### Menger sponge

Started by ArtIco on Fractal Image Gallery

0 Replies
183 Views
December 21, 2017, 11:33:39 AM
by ArtIco
###### inverted Menger Sponge C

Started by mclarekin on Fractal Image Gallery

0 Replies
100 Views
September 26, 2018, 11:22:38 AM
by mclarekin
###### Menger Sponge Tour 2

Started by utak3r on Fractal movie gallery

1 Replies
228 Views
February 22, 2018, 11:37:07 AM
by freakiebeat