claude · @mathr
288 followers · 2739 posts · Server post.lurk.org

Implemented a double helix based on an idea from 's `Knot.frag` (not knighty's, the other one, based on forum posts by DarkBeam).

Not sure how to -ize it, wanted to turn it into a of helices of helices etc. Nor how to make it a single helix (I only managed to colour the two halves individually...).

I think each strand is an Archimedean Serpentine, but I'm not 100% sure on terminology..

```
330 compatibility

providesColor
"MathUtils.frag"
"Complex.frag"
"DE-Raytracer.frag"

Helix

uniform float HelixD; slider[0.0,2.0,10.0]
uniform float HelixR; slider[0.0,1.0,10.0]
uniform float Helixr; slider[0.0,0.5,10.0]

uniform float time;

float DE(vec3 q)
{
q.z += HelixD * time;
float t = (mod(q.z / HelixD + 0.5, 1.0) - 0.5) * 2.0 * PI;
q.xy *= mat2(cos(t), sin(t), -sin(t), cos(t));
q.z = 0;
float s = atan(HelixD / (2.0 * PI), HelixR);
q.yz *= mat2(cos(s), -sin(s), sin(s), cos(s));
return length(vec2(length(q.xy) - HelixR, q.z)) - Helixr;
}

vec3 baseColor(vec3 q, vec3 n)
{
q.z += HelixD * time;
float t = (mod(q.z / HelixD + 0.5, 1.0) - 0.5) * 2.0 * PI;
q.xy *= mat2(cos(t), sin(t), -sin(t), cos(t));
return vec3(0.5) + 0.5 * sign(q.x) * n;
}
```

#fragmentarium #ThreeD #shader #glsl #opengl #group #include #define #version #helix #fractal #fragm #DistanceEstimate

Last updated 4 years ago

claude · @mathr
288 followers · 2739 posts · Server post.lurk.org

set mashed up with algebra (a la ) rendered with in fork of

My highly over-engineered extravagant framework of shaders including each other multiple times with different things defined (to emulate C++ templates with function overloading without polymorphism) takes significantly longer to link the than it does to render the .

First attempts with typos gave 100k lines of cascaded errors in the shader info log, which which the Qt GUI list widget was Not Happy At All. Luckily the log went to stdout too, so I could pipe to a file and see the start where I missed a return statement or two.

#animation #shader #glsl #fragmentarium #fragm #DistanceEstimation #DualNumber #mandelbulb #triplex #ThreeD #fractal #mandelbrot #magnet

Last updated 4 years ago