/hair-experiment

A small experiment trying to simulate hair. Try it here:

Primary LanguageHTMLGNU General Public License v3.0GPL-3.0

hair-experiment

Hair-Experiment

A small and beauty hair simulation made in HTML5.

This is a non-profit implementation. The character used to better illustrate the results belongs to the game A Child of Light.

How it's made?

Each strand of hair is a graph. The root have childrens nodes making a chain. In each animation frame a line is drawned between the nodes making a curve. The simulation is started by the root node following the direction of the mouse (a vector os the last two mouse position). Then, each node moves a little controled by a speed variable in the direction to he's father. With this delay in movimentation is possible to make the moviment smoother and realistic.

Results

Several things can be done to make the result more realistic. The interesting thing to note is the beauty of the result obtained even without much polishing.

TO DO

It is planned to use some ideas to make hair movement more realistic in terms of physics. Each hair's node can have a movement vector that can be accelerated or decelerated according to what's happening to his surrounding. Gravity can be added for more realism (It can be a constant that influences the motion vectors of each node).