@@ -221,11 +221,38 @@ vec3 hsl2rgb(vec3 hsl) {
221221 return hsl.z + hsl.y * (rgb - 0.5 ) * (1.0 - abs (2.0 * hsl.z - 1.0 ));
222222}
223223
224- vec3 domain_color(in vec2 z){
225- float angle = atan (z.y,z.x);
226- float hue = (angle/ (2.0 * PI)) + 0 .5f;
227- float light = (TWO_OVER_PI) * atan (length (z));
228- return vec3 (hue,1 .0f,light);
224+ float get_discontinuous_light(vec2 f) {
225+ // 1. Safety Clamp (prevents infinity artifacts)
226+ float dist = abs (f.x) > 9e+10 || abs (f.y) > 9e+10 ? 9e+10 : length (f);
227+
228+ // 2. Logarithmic Cycle
229+ // log2 means the pattern repeats every time distance doubles (1, 2, 4, 8...)
230+ float logval = mod (log2 (dist), 1.0 );
231+
232+ float decimal_exp = 1.0 ;
233+ if (dist != 0.0 ) {
234+ // Logic: decimal_exp becomes (1.0 - fractional_part_of_log)
235+ // This creates a "sawtooth" wave for brightness
236+ decimal_exp = - (logval - floor (logval) - 1.0 );
237+ }
238+
239+ // 3. Shaping Curve
240+ // pow(..., 0.2) softens the curve (gamma), and -0.15 shifts the darkness
241+ return mod (1.0 / (pow (decimal_exp, 0.2 ) + 1.0 ) - 0.15 , 1.0 );
242+ }
243+
244+ // Main Domain Coloring Function
245+ vec3 domain_color(in vec2 z) {
246+ // 1. Hue (Standard Phase)
247+ float hue = atan (z.y, z.x) / (2.0 * PI);
248+
249+ // 2. Saturation (Keep distinct)
250+ float sat = 1.0 ;
251+
252+ // 3. Lightness (Using your discontinuous logic)
253+ float light = get_discontinuous_light(z);
254+
255+ return vec3 (hue, sat, light);
229256}
230257
231258vec2 convert_coordinates(in vec2 pos, in vec2 resolution, in float range){
0 commit comments