Recent

Author Topic: Glynn Set Curve: GigaTron, Lulu and Boleeman Versions  (Read 1525 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Glynn Set Curve: GigaTron, Lulu and Boleeman Versions
« on: January 04, 2026, 01:52:59 pm »
Glynn Set Curve

A curve with Beautiful Geometry
The Glynn Set is a special Julia Set, named after Earl Glynn.
It kind of looks like a tree (Mine looks like a monkey's face).

Get the Super Duper Lulu OpenGL version 5 Replies down


I tried making a multicolored one, but it renders very slowly.
I tried speeding it up using scanline, but it is still very slow at rending.
Got up to version 9, but the multi-threading did not work so here is version 8.

Perhaps someone can do a quicker rendering multi-threaded or OpenGL version for the forum?


PS: Needed to reduce the size of the png as it was too big in size (many colours)


Enjoy.

« Last Edit: January 09, 2026, 08:24:51 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Beuatiful Geometry
« Reply #1 on: January 04, 2026, 02:00:38 pm »
Also made a plain coloured one using setpixel )version 3).

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Beuatiful Geometry
« Reply #2 on: January 04, 2026, 03:44:08 pm »
Ah, finally found the whole set and special effects.

2nd png looks a bit like an "owl's face".
« Last Edit: January 05, 2026, 10:54:58 pm by Boleeman »

Lulu

  • Sr. Member
  • ****
  • Posts: 401
Re: Glynn Set Curve: Beuatiful Geometry
« Reply #3 on: January 04, 2026, 11:56:33 pm »
Hi Boleeman,
I converted your project to an OpenGL version with OGLCScene library. To use, you have to install package BGRABitmap from OPM and OGLCScene from https://github.com/Lulu04/OGLCScene/releases/tag/v2.3

With this version I can't reach the last beautifull result you have posted. Did you have another version of the project ?
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Beuatiful Geometry
« Reply #4 on: January 05, 2026, 01:48:41 am »
Many thanks Lulu for doing the conversion.

I tried it out and it certainly is responsive, but lacks colours and has tiny pixel dots.
(I think it is due to the HSL function I was using, it is not the one from TBgrabmp))

Attached is another version using HSLA from bgrabmp.
Please give that a go.

Thanks for helping out with the OpenGL version.

Also attached is a modified one png which I did just now using Paint.Net using a capture of yesterday's version of the Glynn Set Maker.
« Last Edit: January 05, 2026, 02:11:01 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Lulu OpenGL Verrsion Working
« Reply #5 on: January 05, 2026, 01:37:46 pm »
Lulu,

After many hours of tinkering about with your code I finally got the OpenGL working.

I learnt heaps about how to do it from your code.
Thanks Lulu for helping out with the conversion.

As shown, in the RGB mode the tree has a nice gradient colour. In the HSB modes the tree consists of multi-colours (Took me ages to figure that one out the OpenGL way with your 2048 texture)

Enjoy.

Fixed up the startup bug so I re-uploaded everything (Did not set some initial values)
« Last Edit: January 05, 2026, 02:22:05 pm by Boleeman »

Lulu

  • Sr. Member
  • ****
  • Posts: 401
Re: Glynn Set Curve: Lulu OpenGL Version Working Now
« Reply #6 on: January 05, 2026, 06:26:43 pm »
Boleeman, you are a magician !
This demo is very nice and work perfectly. I like it  :)
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Lulu OpenGL Version Working Now
« Reply #7 on: January 05, 2026, 10:35:51 pm »
Thanks again Lulu for the initial conversion.

My knowledge of OpenGL was limited so I would have found it difficult to know where to start from. Initially I was going in and out of the various units trying to work out the code logic. The more I looked at your code, the better the understanding. The shader code was interesting. Saw something like it in other programs, but did not really pay much attention until I worked on your conversion.

You are very welcome to put it on your GitHub page if you want to?

I read from from your Github page:
"'I  am an amateur programmer who loves the Pascal language. OGLCScene is an attempt to go as far as possible in my understanding of OpenGL and game engines. The path has been sometimes frustrating, sometimes happy, but very interesting."

Reply:
Boleeman too "is an amateur programmer" The adventure is "usually frustrating" but "becomes very rewarding when a good end result is achieved"

I am not sure, but ...
with the OpenGL version is there a way in the shader the make the edges of the curve where the colors change bleed slightly, sort of like running/fade ink when a paper gets wet with ink writing on it?

Perhaps GigaTron might also know, as he is very knowledgeable with OpenGL programming?
« Last Edit: January 06, 2026, 01:06:02 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Lulu OpenGL Version Working Now
« Reply #8 on: January 06, 2026, 02:56:36 am »
With a small modification we can see the whole Glynn set.

That previous program showed only one of the trees in the whole set.
Don't know how Earl Glynn stumbled across that set?

Lulu

  • Sr. Member
  • ****
  • Posts: 401
Re: Glynn Set Curve: Lulu OpenGL Version Working Now
« Reply #9 on: January 08, 2026, 09:36:29 pm »
Hi Boleeman, sorry for the late answer, I was busy this last time.

Quote
You are very welcome to put it on your GitHub page if you want to?

With pleasure! If you are agree, I will put the version 3.0, I like this one.
I'll do it as soon as possible.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Gigatron

  • Sr. Member
  • ****
  • Posts: 369
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Glynn Set Curve: Lulu OpenGL Version Working Now
« Reply #10 on: January 09, 2026, 12:55:06 am »
Hi

I ve looked your sahder code and made some modification to include this shader on
glCanvas.
Code: Pascal  [Select][+][-]
  1. glJuliaFractal(0, 0, cw, ch, tmr,
  2.                64*2,         // iterations
  3.                80 ,        // minHueOffset
  4.                1.0,        // zoom
  5.                0.0, 0.0,   // offset X, Y
  6.                12.0,       // bleedAmount
  7.                 2);         // colorMode     0-1-2  

What used :

FBM (Fractal Brownian Motion) - distort the UV coordinates before the fractal calculation. 
Noise/dithering -   noise to the normalized iteration value before sampling the palette. 
Multi-sampling - You could also sample neighboring palette positions and blend them together.

All these fonctions are from WWW ; but i understand the technique . Shaders are not easy if
it's complex  ... vec2, vec3, vec4(x,y,z,w) mat2, mat3,mat4 float int ivec bvec etc..
if you understand this you can create a millions fx :)

but you can replace without effort some fonctions like noise, fract , some multisample etc....

This one is not good but working ... hope you like it;

Regards
« Last Edit: January 09, 2026, 12:57:04 am by Gigatron »
Coding faster than Light !

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: Lulu OpenGL Version Working Now
« Reply #11 on: January 09, 2026, 08:24:03 am »
Wow that animation was amazing GigaTron. Almost like a school of Squids.

I needed to shift the curve a little to keep it on the screen.

Was hoping that you would make a glCanvas version, so I could see the bleeding.

Sort of got a fine mist of Blue trail happening.
Was trying to get like a smoky gas trail effect.

I am very new to Shaders, so need to play around more with them.

Thanks GigaTron for the nice animated Glynn Set curve.

As I know you like DemoScene, I recently came across some German Demoscenes at

https://keyj.emphy.de/projects/demoscene/

I especially like the games: BlockOut 8k / 6k  and Kakiarts 8-Ball and Think inside the box

I wanted to make a 3D Blockout game in Lazarus.
I had a VB6 version source somewhere, so I might try to convert it someday.

Thanks GigaTron for your nice Glenn Set Animation. I really appreciate it.
« Last Edit: January 09, 2026, 08:29:53 am by Boleeman »

Gigatron

  • Sr. Member
  • ****
  • Posts: 369
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Glynn Set Curve: GigaTron, Lulu and Boleeman Versions
« Reply #12 on: January 09, 2026, 05:42:23 pm »
Ok ... nice Boleeman ;

You can test and make online shader Faster Than light ; I've quickly prepared the shader
for shadertoy..

1 - Go to : https://www.shadertoy.com/new

2 - Copy & past shader to the right

3 - Click compile to see the result in the left

4 - Good Luck :)

Code: Pascal  [Select][+][-]
  1. // For friend Boleeman
  2.  
  3.   const float u_iterations   = 128.0;
  4.   const float u_minHueOffset = 50.0;
  5.   const float u_zoom = 1.0;
  6.   const vec2 u_offset = vec2(0.0,0.0);
  7.   const float u_bleedAmount  = 12.0;
  8.   const int u_colorMode      =  2;
  9.  
  10.  
  11. // FBMotion function
  12.   vec2 fbm(vec2 uv, float time, float amount) {
  13.     float f = 2.0;
  14.     float a = amount;
  15.     for(int s = 0; s < 3; s++) {
  16.       uv += vec2(sin(uv.y*f + time*0.3), cos(uv.x*f + time*0.3)) * a;
  17.       f = f * 1.5;
  18.       a = a * 0.5;
  19.     }
  20.     return uv;
  21.   }
  22.  
  23.  // HSL to RGB
  24.   vec3 hsl2rgb(float h, float s, float l) {
  25.     float c = (1.0 - abs(2.0 * l - 1.0)) * s;
  26.     float x = c * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));
  27.     float m = l - c / 2.0;
  28.     vec3 rgb;
  29.     if (h < 60.0) rgb = vec3(c, x, 0.0);
  30.     else if (h < 120.0) rgb = vec3(x, c, 0.0);
  31.     else if (h < 180.0) rgb = vec3(0.0, c, x);
  32.     else if (h < 240.0) rgb = vec3(0.0, x, c);
  33.     else if (h < 300.0) rgb = vec3(x, 0.0, c);
  34.     else rgb = vec3(c, 0.0, x);
  35.     return rgb + vec3(m, m, m);
  36.   }
  37.  
  38. void mainImage( out vec4 fragColor, in vec2 fragCoord )
  39. {
  40.     vec2 uv = fragCoord.xy /iResolution.xy;
  41.     vec2 distortedUV = fbm(uv, iTime, u_bleedAmount * 0.01); // uv distortion avant calcul etc..
  42.     float zx = (-0.8 + distortedUV.x * (1.4 - (-0.8)))   *  -u_zoom + u_offset.x; // on inverse le zoom ici plus tard
  43.     float zy = (-0.72 + distortedUV.y * (0.7 - (-0.72))) *  -u_zoom + u_offset.y; // et ici pour val param
  44.     float i = u_iterations;
  45.     while (zx*zx + zy*zy < 4.0 && i > 1.0) {
  46.       float r = sqrt(zx*zx + zy*zy);
  47.       float theta = atan(zy, zx);
  48.       float r15 = pow(r, 1.5);
  49.       float tmp = r15 * cos(1.5*theta) - 0.2;
  50.       zy = r15 * sin(1.5*theta);
  51.       zx = tmp;
  52.       i = i - 1.0;
  53.     }
  54.     float t = i / u_iterations; // multisample
  55.     float noise = fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);  // bruit
  56.     t = clamp(t + noise * u_bleedAmount * 0.02, 0.0, 1.0);   // lissage
  57.     vec3 color;
  58.     if (u_colorMode == 0) {
  59.       float r = mod(t * 7.0 * 255.0 + u_minHueOffset, 256.0) / 255.0;
  60.       float g = mod(t * 5.0 * 255.0 + u_minHueOffset * 2.0, 256.0) / 255.0;
  61.       float b = mod(t * 3.0 * 255.0 + u_minHueOffset * 3.0, 256.0) / 255.0;
  62.       color = vec3(r, g, b);
  63.     } else if (u_colorMode == 1) {
  64.       float hue = mod(0.0 + u_minHueOffset + t * 360.0, 360.0);
  65.       color = hsl2rgb(hue, 0.6, 0.52);
  66.     } else if (u_colorMode == 2) {
  67.       float hue = mod(120.0 + u_minHueOffset + t * 360.0, 360.0);
  68.       color = hsl2rgb(hue, 0.6, 0.52);
  69.     } else {
  70.       float hue = mod(240.0 + u_minHueOffset + t * 360.0, 360.0);
  71.       color = hsl2rgb(hue, 0.6, 0.52);
  72.     }
  73.     // Output to screen
  74.     fragColor = vec4(color,1.0);
  75. }
  76.  
  77. // End of Transmission :)

Regards Gigatron
« Last Edit: January 09, 2026, 10:00:50 pm by Gigatron »
Coding faster than Light !

Gigatron

  • Sr. Member
  • ****
  • Posts: 369
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Glynn Set Curve: GigaTron, Lulu and Boleeman Versions
« Reply #13 on: January 09, 2026, 08:02:42 pm »
Hi

Here is mixed function to make Eclipse like shader took 30 min;

Copy code to shadertoy ; https://www.shadertoy.com/new

You can now play and understand this basic shader..

Have fun

Code: Pascal  [Select][+][-]
  1. // functions formula from WWW
  2. float hash(vec2 p) {
  3.     return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
  4. }
  5.  
  6. float noise(vec2 p) {
  7.     vec2 i = floor(p);
  8.     vec2 f = fract(p);
  9.     f = f * f * (3.0 - 2.0 * f);
  10.    
  11.     float a = hash(i);
  12.     float b = hash(i + vec2(1.0, 0.0));
  13.     float c = hash(i + vec2(0.0, 1.0));
  14.     float d = hash(i + vec2(1.0, 1.0));
  15.    
  16.     return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
  17. }
  18.  
  19. float fbm(vec2 p) {
  20.     float value = 0.0;
  21.     float amplitude = 0.8;
  22.    
  23.     for(int i = 0; i < 5; i++) {
  24.         value += amplitude * noise(p);
  25.         p *= 2.0;
  26.         amplitude *= 0.8;
  27.     }
  28.    
  29.     return value;
  30. }
  31.  
  32. // End fonctions
  33.  
  34. void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  35.     vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  36.    
  37.     float dist = length(uv);  // distance pour cercle
  38.     float angle = atan(uv.y, uv.x); // autour du soleil
  39.    
  40.     float sunRadius = 0.3;
  41.     float turbulence = fbm(vec2(angle * 5.0, dist * 10.0) + iTime * 0.1) * 0.02;
  42.     float sunEdge = sunRadius + turbulence;
  43.     float sun = smoothstep(sunEdge + 0.02, sunEdge, dist); // le cercle soleil lissage
  44.    
  45.     float ejection = fbm(uv * 8.0 + iTime * 0.3);
  46.     ejection += 2.8 * fbm(uv * 16.0 - iTime * 0.5);
  47.    
  48.     vec3 sunCol = vec3(1.0, 0.7, 0.2);  // soleil  couleur
  49.     sunCol += vec3(0.5, 0.2, 0.0) * ejection;
  50.     sunCol *= (1.5 + ejection * 0.5);
  51.    
  52.     float corona = exp(-abs(dist - sunRadius) * 8.0); // couronne soleil
  53.     float flares = fbm(vec2(angle * 3.0, 1.0) + iTime * 0.2) * 0.1;
  54.     corona += flares * smoothstep(sunRadius + 0.3, sunRadius , dist );
  55.    
  56.     vec3 coronaCol = vec3(1.0, 0.5, 0.1) * corona * 0.5;
  57.    
  58.     float moonX = sin(iTime * 0.0) * 0.15; // posx
  59.     vec2  moonPos = vec2(moonX, 0.0);      // just xpos
  60.     float moonDist = length(0.83*uv - moonPos);  // cercle lune avec sa taille
  61.    
  62.     float moonRadius = 0.28;
  63.     float moon = smoothstep(moonRadius + 0.01, moonRadius, moonDist); // lissage cercle
  64.    
  65.     vec3 col = sunCol * sun;
  66.     col += coronaCol;
  67.     col = mix(col, vec3(0.0), moon);  // mélange col + black + moon
  68.    
  69.    
  70.     fragColor = vec4(col, 1.0);
  71. }
Coding faster than Light !

Boleeman

  • Hero Member
  • *****
  • Posts: 1108
Re: Glynn Set Curve: GigaTron, Lulu and Boleeman Versions
« Reply #14 on: January 09, 2026, 11:19:23 pm »
Hi GigaTron. Thanks for letting me know about shadertoy. I have seen ShadrToy before, but never really understood what it was about until now. So that is how you prototype the shader code. I was the Shader code in Lazarus and it was time consuming, wait for the compiling to complete and then altering it with new additions.

Had a bit of a heat wave where I live. The eclipse shader reminds me a bit of yesterday''s extreme hot solar flare weather.

Looking at the color mode of the Glynn set shader code, the colors are offset by intervals of 120 plus further offsets. Do you know what type of noise is being used? (Perlin, simplex, etc ?).

Shader code has interesting vector code (so that's probably why it is used in 3D rendering, makes sense).


I came across some C# Buddhabrot code which rendered the fractal in OpenCL at https://github.com/nikvoronin/BuddhabrotCL and thought of perhaps doing something similar in Lazarus. You can download the exe at https://github.com/nikvoronin/BuddhabrotCL/releases and it even has other fractals in the Kernel Menu.

I (and DZandaa) made a BuddhaBrot in Lazarus ages ago in TBgrabmp ( at https://forum.lazarus.freepascal.org/index.php/topic,67464.msg519357.html#msg519357 ), but with OpenGL and Shader it probably would have rendered much more nicely. I was after the similar trippy effects as the C# Buddhabrot code.


Thanks for the great info. on Shader GigaTron.

 

TinyPortal © 2005-2018