Code golfing a tiny demo using maths and a pinch of insanity

blog.pkh.me

101 points by ux 3 days ago


recursive - 2 days ago

I 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<.001?0.:1.))
    w = g-g/exp(mix(h*3e2,d*2.5,a=h<.001?0.:1.))
vintermann - 2 days ago

Using maths, insanity, and a ton of calculation horsepower... That made my graphic card fan turn on instantly!

bangaladore - 2 days ago

The 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.

samwhiteUK - 2 days ago

Unbelievably cool, well done!

mielioort - a day ago

Needs dragons flying sunwards

ForHackernews - 2 days ago

If anyone is interested in learning more about this kind of coding https://thebookofshaders.com/ is a fantastic intro.

sgarland - 2 days ago

This is utterly bonkers to me, well done.