Code golfing a tiny demo using maths and a pinch of insanity
1–10 of 23 posts
Re: Code golfing a tiny demo using maths and a pinch of insanity
#2> WARNING: Too many active WebGL contexts. Oldest context will be lost.
Re: Code golfing a tiny demo using maths and a pinch of insanity
#3 w = g-g*exp(-mix(h*3e2,d*2.5,a=hRe: Code golfing a tiny demo using maths and a pinch of insanity
#4I don't know much about 3d stuff or shaders or this language, but I know golf, and I think I found a byte to save. w = g-g*exp(-mix(h*3e2,d*2.5,a=h
Re: Code golfing a tiny demo using maths and a pinch of insanity
#5The top demo doesn't function on Edge or Chrome on Windows due to too many webgl contexts. > WARNING: Too many active WebGL contexts. Oldest context will be lost.
The code on the blog is pretty simple and naive (I'm not a webdev): https://github.com/ubitux/scripts/blob/main/share/blog/shade...
Any suggestion on how to address the issue is welcome.
Note: I don't have any Windows machine to test with
Re: Code golfing a tiny demo using maths and a pinch of insanity
#6I don't know much about 3d stuff or shaders or this language, but I know golf, and I think I found a byte to save. w = g-g*exp(-mix(h*3e2,d*2.5,a=h
Hey, thank you, that's a nice one. I added the change to the Shadertoy version with your credit. I will add a note/update on the blog and demo page later. Thanks again :)
Re: Code golfing a tiny demo using maths and a pinch of insanity
#7Earlier quoted context omitted.
Hey, thank you, that's a nice one. I added the change to the Shadertoy version with your credit. I will add a note/update on the blog and demo page later. Thanks again :)
Is it actually necessary to specify `a` as a floating-point literal? Will it not be implicitly converted?
If you see a way to make it shorter, feel free to share :)
Re: Code golfing a tiny demo using maths and a pinch of insanity
#8The top demo doesn't function on Edge or Chrome on Windows due to too many webgl contexts. > WARNING: Too many active WebGL contexts. Oldest context will be lost.
Ah, someone reported this to me today, but I must admit I have no idea how to address the issue. Currently the canvas animations are stopped when out of context, but yeah they have to be loaded. The code on the blog is pretty simple and naive (I'm not a webdev): https://github.com/ubitux/scripts/blob/main/share/blog/shade... Any suggestion on how to address the issue is welcome. Note: I don't have any Windows machine…
Re: Code golfing a tiny demo using maths and a pinch of insanity
#9The top demo doesn't function on Edge or Chrome on Windows due to too many webgl contexts. > WARNING: Too many active WebGL contexts. Oldest context will be lost.
What am I saying? Fine? It's freaking awesome.
Re: Code golfing a tiny demo using maths and a pinch of insanity
#10I don't know much about 3d stuff or shaders or this language, but I know golf, and I think I found a byte to save. w = g-g*exp(-mix(h*3e2,d*2.5,a=h
w=g-g*exp(...),g-=w*a,c+=w*a*d*9.+...,c.r+=w*a*a*2,...
w=g-g*exp(...),g-=w*=a,c+=w*d*9.+...,c.r+=w*a*2,...
(I've tested this with the Shadertoy version. YMMV.)