toad.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server operated by David Troy, a tech pioneer and investigative journalist addressing threats to democracy. Thoughtful participation and discussion welcome.

Administered by:

Server stats:

272
active users

#glsl

3 posts3 participants0 posts today

I just realized that implementing a shadertoy-like webgl embed was extremely easy, so I guess I won't have to deal with lossy and bandwidth heavy videos in my next blog post, I'll just embed them with this little widget of 80 lines of js I just wrote.

Let's see now how the integration is going to work with my little blog script...

I used to pick the time as the 3rd dimension to debug the 3D gradient noise, but unless you're into cloudy atmospheres, it's much better to display it on a 3D sphere.

Note: partial derivative magnitude on the right side if you wonder

I don't know who needs to hear that, but if you need to call atan(x) with x in [-1,1], a linear remapping (straight line) to [-π/4,-π/4] is an okayish approx.

I checked the hermite (smoothstep), and it's also kinda acceptable, just the other way around.

Then I thought "their average could be interesting"... And it's indeed actually pretty good!

Is this useful? Probably not.

Simplifying the expressions, you get:
atanlol(x) = mix(-π/4,π/4,(x+1)/4+smoothstep(-1,1,x)/2)

#Fractalfriday
I updated my #Shadertoy #fractal explorer. Link: shadertoy.com/view/33sSRf
It now supports skewing the C-plane using a quad of four draggable points. The coefficients 'a' and 'b' can now also changed by the mouse. To show the points, simply hold the space bar.

Here is a video which demonstrates that.
The formula is \(z_{n+1}=z_n^2*\frac{z_n-a}{z_n-b}+c\)
where a and b are the blue points in the video.

So I was making a random 2d map in #shadertoy, and I was trying to understand the effect of the rotation of the coordinate in a fbm 2d #noise loop, so I plugged the mouse coordinates onto the rotation angle and started to play with it to see what it did.

To my surprise, it felt like a "fire" effect, directed in one direction or the other. I feel like this could really be used to make an actual fire effect, though I'm not sure if I'm doing the rotation right at the moment...

It still baffles me that #GLSL (or even #WGSL) does not have a linearstep() function but only smoothstep(). Same with linear() for parity with mix().

To this day, I remain convinced most of the smoothstep() uses could be replaced with a linearstep(), but most people don't because it's too much hassle to write it down.

For the record I mean:
linear(a,b,x)=(x-a)/(b-a)
linearstep(a,b,x)=saturate(linear(a,b,x))

So #Python doesn't seem to have short vectors (vec2, vec3, vec4) for fancy operation like in #GLSL. For example, you can't just do (2,7) + (4,-3) and expect (6,4).

But it has a native complex support, so you can do this:

>>> 2+7j + 4-3j
(6+4j)

🤯

Edit: and you can multiply by a scalar as well of course:

>>> (3-2j) * -2
(-6+4j)