Main content
Pixar in a Box
Course: Pixar in a Box > Unit 4
Lesson 1: Hair simulation 101Spring-mass system
Now let's explore how we can use springs to represent hair.
Want to join the conversation?
- What about the friction of the hair strands is there a mathemathical formula or written code for that to look into ?(7 votes)
- Hi Nahsor,
This is a great question! My guess is that this would be more complicated than necessary. When doing these sorts of activities you are looking for some level of "good enough" when approximating natural phenomenon, and generally only in specific circumstances. One example that comes to mind is wind. If you spend several hours outside you will note that there is generally some wind throughout that time and that it varies; however, wind is rarely used in animation unless for a specific activity or event (e.g., a storm, flying, etc.).
Onward!(5 votes)
- but if the magnitude is greater what happens to the spring stiffness or does it affect the gravity(7 votes)
- why does it not let me watch the video(3 votes)
- Try reloading the page or restarting your device.(7 votes)
- How much do you software engineers earn?(5 votes)
- What would happen if you attached two springs together and let them bounce?(1 vote)
- Nothing particularly special. The weight of the bottom spring would pull on the top spring, causing it to stretch. Then, when the top spring flicks back into place, it will pull the bottom one along. When the top spring is at its most contracted, and can't contract any further, it will expand due to gravity, but not before sending a small shockwave to the bottom spring. (This is because as it snaps back into place, it generates a small amount of force. As every action has an equal and opposite reaction, it'll send that shock down toward the bottom spring.) This will cause a slight offset. Over time, both of the springs will lose momentum and go into resting position. More information can be found in the lesson about stiffness & damping on KhanAcademy, here: https://www.khanacademy.org/partner-content/pixar/simulation/hair-simulation-101/v/sim3-launch(5 votes)
- Why is stiffness represented as k?(2 votes)
- What about straight hair? Would they use a different technique, or would they use the same method?(2 votes)
- This is the best thing ive ever done :happyface:(2 votes)
- I was just going to say that I wrote a JS program about 10 years ago that was similar. I used springs and attractive forces between the particles. Each particle when it gets close enough to another particle will "latch" on via a spring mechanism. The attractive force brings them close to the point where the springs force overcomes the attractive force, and they spring away to interact with new particles. This seems very similar to that. I pulled the code out of a 20 year old Games Physics book - an actual physical copy :)(2 votes)
- Would displacement only matter as an absolute value? Seeing as it springs back and forth, no matter whether displacement is positive or negative?(2 votes)
- Hi Carlos,
Great question! In some respects, possibly; however, remember that positive and negative denote the direction of the displacement from the spring's natural resting position.
Onward!(0 votes)
Video transcript
(bouncy Pixar theme) - In the last exercise
you probably noticed that the simulation lacked the
natural bounciness of hair. But what makes something
look bouncy anyway? To make this model bouncy,
we need each strand of hair to expand and contract slightly when forces are applied to them. This required a new physical
analogy to base our model on, so we tried springs. Springs are great because
they can change length when you pull on them, and to give the hair a
little bit of weight, we add a small weight to
the end of the spring. This is known as a mass spring system. We can actually draw a mathematical model to explain what happens when a
spring expands and contracts. The model we use is based on a
law developed by Robert Hooke a 17th century physicist. Hooke noticed that there
are two things to consider when a spring expands and contracts. One, if we pull on a
spring and it expands, we will increase its length
and it will pull back together. Two, if the spring contracts,
its length will decrease and it will push apart. How much a spring pushes and pulls is known as the spring force. Robert Hooke was looking for relationship between the spring force in the amount the spring
contracts or expands. We call this change in
length displacement. Displacement is defined
as the current length minus the rest length of the spring. When we stretch a spring,
the displacement is positive and the resulting spring
force is negative. This is known as the pull force. When we compress a spring,
the displacement is negative and the resulting spring
force is positive. This is called the push force. So Hooke's observation was quite simple, he noticed that a larger displacement results in a larger force, while a smaller displacement
results in a smaller force. That is, he noticed that the displacement is proportional to the force. However, every spring is different, some take a lot of force to displace, and some are really easy to displace. So Robert Hooke introduced
the idea of stiffness to account for how hard it is
to displace a given spring. It is represented with the letter k. This led Hooke to his final equation which is known as Hooke's Law. The spring force is proportional to a stiffness times the displacement. Notice that there is
a negative sign there, that's because we want a positive force when the displacement is negative, and a negative force when it's positive. If we plug this equation into the computer we get this realistic spring behavior. For Brave, we modeled the horse's hair using a mass spring system similar to what we are
describing in this tutorial, nearly 10,000 simulated hairs in total. In the next exercise you can explore a simple mass spring system. You'll be able to adjust
the following parameters, mass of the particle, spring stiffness, k, and the force of gravity, and we'll ask you some challenge questions to make sure you understand
the basics of Hooke's Law.