21 ms·
I'm not good with shaders; can someone explain on a high level how this works? I guess it somehow draws lines along in low-gradient directions in dark areas, w
by blauditore 9y ago
I'm not good with shaders; can someone explain on a high level how this works?
I guess it somehow draws lines along in low-gradient directions in dark areas, with some randomization. But I can't really tell from looking at the code.
- dahart 9y agoYou got it right at a high level. The main bit of line drawing is the velocity calculation in the middle of the propagate() function: // calculate velocity change vec2 dvel=vec2(0); float dir = (float(p.idx%2)*2.-1.); // every 2nd particle is bent left/right // vel tends towards gradient dvel -= 10.*gu*(1.+sqrt(gl*2.))*sc; // vel tends towards/away from normal to gradient (every second particle) dvel -= 20.*N(gu)/(1.+1.*sqrt(gl*100.))*sc*dir; // vel bends right/left (every second particle) dvel += .06*N(p.vel)/(1.+gl*10.)*dir;
- jcims 9y agoIt's fun tinkering with all of the constants throughout the script (don't forget to click Apply at the bottom). It's surprisingly robust to changes, they just flavor the image in various ways.