Hacker News new | comments | show | ask | jobs | submit login
Equations for Organic Motion (codepen.io)
87 points by trueduke 1642 days ago | hide | past | web | 33 comments | favorite



None of these look organic to me. I spent some time trying to get robot movements to look organic, and motion-capturing human movement. I believe no simple trig formula can generate plausible animal movements.


Simple is the operative word. I work for a robotics lab specializing in bipedal locomotion and we're developing a robot that exploits the periodic, superpositioned waveform nature of passive dynamics to produce a stable gait at varying speeds while only actuating at the hip. The mechanics behind the project involve tuning the sinusoid that governs the hip joint pitch in conjunction with the up/down motion at the knee. This tuning is done using a fairly neat tendon network since we only introduce mechanical power at the hip joint. The resultant behavior is clearly a non-linear controls problem, but at it's heart it's still trig. Just not simple trig.

The robot is modeled after an ostrich. You can read more about it on our organization's website if you want: http://www.ihmc.us/groups/fastrunner/


Do you have any algorithms or tips for writing algorithms that try to simulate animalistic movement? I've been looking for something along those lines for a project I'm doing in my robotics class.


Yes, if periodic = organic. Otherwise these are generic trig equations with no particular relation to "organic" motion.

Are the orbital paths of planets "organic" or just interesting physics?

To me, a truly "organic motion" would be a differential equation that describes an organic process as a function of time, like the logistic function:

http://en.wikipedia.org/wiki/Logistic_function

This has the advantage of possessing an actual relation to organic processes, rather than being a member of a large class of functions that have no specific connection to life.


Curious, this may be more of a philosophical question: what is the reason why these organic-seeming movements can be modeled mathematically, specifically with trigonometric functions? Why do biological processes seem to obey trig like so?


Biological processes are composed of chemical processes, and chemical processes are often modeled with differential equations. The trig functions (sine and cosine) and the exponential function are all solutions to the simplest second and first order linear differential equations, respectively. You might equally ask why the planets follow the trig functions so closely when they orbit the sun, or why the shape of the Earth is close to a sphere, or why the first digit of the amount of money in your pocket has a roughly 30% chance of being 1, but only an 18% chance of being 2.


Would second order differentials imply linear acceleration?

Would we then always get better approximations the higher the order?

EDIT: I ask this because linear acceleration doesn't seem like something which might readily occur in nature.


You can get constant (not linear) acceleration with a second order differential equation. Here is an example:

    d^2 x
    ----- = -g
    dt^2
Solving this gives us the parabola we are all familiar with, when an object falls under constant acceleration:

    x = -1/2 g t^2 + v_0 t x + x_0
This is a second order differential equation, but it is too trivial an example. Here is a more interesting differential equation:

    d^2 x
    ----- = -x
    dt^2
All solutions to this equation take the form:

    x = a sin t + b cos t
There are a lot of physical materials in nature which produce this kind of relationship between force and position. Basically, anything that is kind of like a spring. Reach over and flick a glass on your desk with your fingernail. Hear it ring? The sine wave that it's ringing with is predicted by the relationship between force and position that we understand. Every tuned musical instrument in the world, with one exception, generates notes that can be modeled by some differential equation. Pianos, violins, and horns are relatively easy; drums are much harder but still tractable.

The chemical and physical systems in living tissue are much more complicated. Our best models for them often incorporate nonlinear elements (the sine wave example is linear) or a large number of variables. But periodic behavior is still quite common, and the sine wave is in some senses the simplest function that is smooth and periodic.

Note: The one musical instrument for which differential equations are not the best model is the digital synthesizer.


> what is the reason why these organic-seeming movements can be modeled mathematically, specifically with trigonometric functions?

Any motion can be modeled mathematically. There are probably infinite equations that provide "organic looking motion". I could make one that made really good looking motion but was really long and complex and you could have a parallel person asking "why is nature so messy and not giving us simple motion?". The insight here is to not attach any special significance just because "it looks organic". In reality what we are probably saying is that it "looks smooth". (In fact you could look at Bezier curves which are often used for animations to see non-trigonemtric examples, which while easy to define are relatively complex to actually run through http://en.wikipedia.org/wiki/Bézier_curve . All of iOS's built-in famous smooth animations use these.)

So let's break these down. All of these examples are periodic. So for starters we need a good periodic function. We could have started with y = |(x%2) - 1| ( http://tolmasky.com/letmeshowyou/notsmooth.png ). That would give us the back and forth motion we want, but would have not looked smooth, since we linearly increase, then linearly decrease, and in the middle abruptly change. Your eye would catch that abruptness and that's what would give it the "inorganic feel" (despite the fact that there are plenty of things in biology that are super abrupt).

So what we want instead is the same kind of back and forth, but rounding off the edges. You could imagine forming a function by taking a normal parabola (y=x^2) and an inverted one (y=-x^2), and putting them together to get the rounded bottom and top corners ( http://tolmasky.com/letmeshowyou/twoparabolas.png ).

Luckily for us, we've already discovered a class of functions that give us something similar in the form of sine and cosine. Now, the reason why these are smooth and periodic is simply because the values of these functions are derived from tracing along a circle ( http://www.galaxygoo.org/math/sineCurve.html ). Now that you know this, you have a "tool" for your mathematical bag of tricks: every time you want to do something smooth and periodic, you are probably going to reach for sine or cosine. Similarly, if you want to now tweak this and have things ramp up in speed or down, you could try using exponents, etc.

Hopefully this sheds a little light on what's going on here.


"Why do biological processes seem to obey trig like so?"

I'm not sure I would say that biological processes obey anything - merely that we can find it useful to describe real world behaviour in terms of these abstract mathematical functions. Of course, it's interesting to speculate if there is a link between the level of maths required to usefully model the real world and the level of maths we are happy working with - i.e. if the real world was much more complex would we also have developed a much more richer natural ability for mathematics.


Organic-seeming movements can be modeled with a sum of a set of sines and cosines. Are you talking about Fourier series?


are you asking a reasonable question? do you have a clear idea of some regular change in size that would not "appear organic"? because i suspect that almost any smooth, repeating change would be acceptable... and if that's so, then your question is largely meaningless.


They are not organic, they are just smooth. Any other smooth motion probably would do.


I'm curious what equation would approximate best the human limb movement such as when I'm moving my hand in front of me from left to right.

I'm not sure why but for me even motioncaptured movements seem unnatural and give no illusion of life.


"...even motioncaptured movements seem unnatural and give no illusion of life."

I often agree with this. When digging deeper into the details of why this is the case, it's often because the motion captured data is played back on a model of different proportions than the actor. I think I first noticed this when a magazine article did a writeup on The Polar Express movie. There's a photo of Tom Hanks in a mocap suit beside a rendering of the train conductor in the same pose. The conductor's proportions were completely different from the real Mr. Hanks. I've also noticed this problem when ballet is mocapped and applied to computer models.

My opinion, since I'm no CGI expert nor hobbyist, is that actual natural movement has no place in a cartoon. You'll notice that each of Pixar's worlds maintains its own naturalness - Mr. Incredible moves the right way with respect to the 3D model in his own universe as do the other characters. Although they modeled Syndrome's swagger on a Pixar employee (or at least a real human if not a fellow Pixarite), that doesn't mean they applied an actual mocap session's data to the character model. Every time I've seen anything "behind the scenes" of a Pixar film, they're animating movement 'manually' and maintaining a 'natural' feeling within the context if the current project.


I agree about cartoons. The creation of movement is essential part of the uniqueness of given art piece. But I'm talking about endeavors that aim to create virtual version of reality, some games, movie fx etc.


Maybe simply sin(x) and cos(x) with some limitations on how much it can flex.

If you look at your arm joint from the elbow up, keep your elbow in a fixed point you move your arm in a circular motion on a plane. The same applies for your hand on your wrist joint.

Extending that your arm moves in 3 dimensions so fixed point elbow means you can move your arm in a sphere.

But you cant reach every point on the sphere, because of the way the muscles work, which is why you need to limit it. It's really hard to get those limits right, which is why the artificial characters dont look natural .. if their hand moves to a point where your subconscious mind see's that position would be painful or impossible, then it looks unnatural.

My old calculus teacher used to always tell us to flip the paper around when you're drawing a curve, so the curve you're trying to draw moves naturally with the arc of your arm .. you get a much sexier curve that way.


It depends how you move your hand, of course, but 'easeInOutQuint' from Robert Penner's easing equations[1] is a fairly good approximation of a hand, finger, or cursor moving quite quickly from one point to another in a straight line.

The movement is almost linear, except for the rapid acceleration when you hand begins to move and the rapid deceleration as it slows to focus on a point.

[1]: Example, with onion skinning: http://gizma.com/easing/ [requires Flash] (Check x and y under the "Qnt" column on the bottom row, then click anywhere in the box to move the ball.


The demo for this jQuery easing plugin also allows testing the easeInOutQuint equation:

http://gsgd.co.uk/sandbox/jquery/easing/


There are several ways to approach this, but one of the more common ones is to use minimum-jerk trajectories:

http://www.shadmehrlab.org/book/minimum_jerk/minimumjerk.htm


http://en.wikipedia.org/wiki/Fitts%27s_law

Movement time = Start/stop time + Speed * log (1 + Distance / Width of target)


I get a mostly-blank page on Firefox 17. What browsers does this support?


Firefox 17 here. Mostly blank page, even after allowing whatever wanted to run in Noscript. But the page started working (although, without colours for some reason) when I disabled Noscript and restarted firefox.


Huh. I'm a NoScript user, so that might be it. Thanks.


For me the animations work on Firefox 19 (Aurora) on Windows, but no colors.


Firefox 17 on Ubuntu 12.04. Works fine for me.


Doesn't work for me on Firefox nightly either.


nice, you can use these to get some really nice polishing in iOS apps. Thanks for sharing.


Those aren't right. There should be an abs() around each trigonometric function.


This is very hypnotoad-ish.


Wouldn't it be both more robust and more efficient to use B-splines?


It would be certainly more efficient to actually simplify many of the obviously overly complicated "formulas" there. Just for the sake of argument, you achieve the same "effect" of sin(t)cos(t) with a simple sin(2t) (ignoring the 0.5 multiplying the sin that made the amplitude of the movement unnecessarily small).


How would you substitute one for the other?




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: