Thursday, March 04, 2004

hair dynamics

robert hodgin posted a great little sketch about fluid dynamics a few days ago. at it's core is a simply particle system & great use of the (perlin) noise() function. based on each particle's position a noise value is computed and intepreted as rotational angle. particles are then drawn as lines in the direction of their current angle.

after playing around with the code for while, i suddenly realised how easily it could be adapted to simulate hair. in principle, all what's needed was to increase the length of the particle lines and add some lighting calculations for the gloss. now each particle receives a slightly randomized base colour when it is created and which is then modulated by the line's current angle in relation to the light direction. the resulting play and movement of the highlights and dark areas makes it hard to believe there's no 3d involved at all and the image is "only" made of 60000 shaded lines.

remixed sketch, video versions and source are here: /p5/remixed/hair/