mastodon.ie is one of the many independent Mastodon servers you can use to participate in the fediverse.
Irish Mastodon - run from Ireland, we welcome all who respect the community rules and members.

Administered by:

Server stats:

1.6K
active users

#shader

3 posts3 participants0 posts today
Continued thread

@jasoncoon recently posted a cube shader that runs colorwaves around the cube's perimeter. I tried expanding that to three nesting cubes.

This color scheme is a throwaway, but I tried a spatial dither to smooth the hue changes at low brightness. There are interesting possibilities to explore there.

Source: gist.github.com/kbob/c93e9fcfd
Jason's post: leds.social/@jasoncoon/1149734

In #GLSL there is no isfinite(), so when you're doing an unsafe division, you need to check both isinf() *and* isnan(). Why? Because x/0.0 is inf, unless x=0.0 in which case it's NaN... And this makes me sad.

The trick r==r doesn't work because it is true for inf: it only works as an alternative for isnan() :(

Edit: I guess I could do

bool isfinite(float x) {
return (floatBitsToUint(x) & 0x7f800000u) != 0x7f800000u;
}

Just learned that my little visual cosine gradient generator tool (from 2015) is featured in this popular video tutorial (1.1M+ views) about artistic shader programming:

youtu.be/f4s1h2YETNY?t=971

The tool is still here:
dev.thi.ng/gradients/

If you want to use these gradients outside shaders (e.g. for dataviz purposes), the actual gradient functionality is also included in these two libraries:

thi.ng/color (TypeScript/JavaScript)

Related readme section with presets and code examples:
github.com/thi-ng/umbrella/blo

Clojure/ClojureScript version:
github.com/thi-ng/color/blob/m

I think I'm done with it. I fixed the clipping and the colors.

I'm still not satisfied with the raymarch glitching a bit, especially on the summit edges. If someone has ideas to improve it, I shared it on shadertoy: shadertoy.com/view/333XDH

I believe that's because we're matching the exit edge of the shape when it's close, but I'm not exactly sure how to fix that. In any case, patch welcome :)

The box cut is not perfect but we're getting there!

Edit: also, fun stuff, I realized I could return transparent pixels, so the web page background takes over and it looks like the shape is floating on it. It's stupid but I love it :3