w = g-g*exp(-mix(h*3e2,d*2.5,a=h<.001?0.:1.))
w = g-g/exp(mix(h*3e2,d*2.5,a=h<.001?0.:1.))If you see a way to make it shorter, feel free to share :)
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.)But! You can save 1 char by replacing w with a:
g -= a*=w,
c += a*d*9.+...
a = min(...),
c.r += w*a*a*.2,
So thank you for the idea! (d==0.?K*.01*h:c-c)
could become (d>0.?.0:.01)*K*hI added your changes to the Shadertoy version with your HN nickname. I'll integrate it to the original later.
Thanks!
It seems that leaving the obsession behind some more can save another byte.
bangaladore•4mo ago
> WARNING: Too many active WebGL contexts. Oldest context will be lost.
ux•4mo ago
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
timojaask•4mo ago
sgarland•4mo ago
greggman65•4mo ago
https://github.com/greggman/virtual-webgl
If you want to make your own solution there's one listed here about 1/2 way down the page
https://webglfundamentals.org/webgl/lessons/webgl-multiple-v...
As an aside, WebGPU doesn't have this issue or at least has it less. For one, WebGPU can use a single device to render to multiple canvases, something WebGL can't. Another is that WebGPU is mostly stateless making it easier for both the user and the browser.
ux•4mo ago
user1093298•4mo ago
What am I saying? Fine? It's freaking awesome.