I'm starting up a new (likely very rarely updated) blog series for going over some practical tips and tricks for working with Unreal's material graph to do a variety of very common things for VFX and Technical Art. This version was originally posted on Art Station, but has moved here.
A small segment of the Gears 5: Hivebusters DLC using the techniques in this blog post.
A small segment of the Gears 5: Hivebusters DLC using the techniques in this blog post.
This technique can be used for anything that needs to hang like a rope with a weight at the end, doesn't need to physically interact with anything, and just needs to do cool stuff. Vines and Ivy, pendants, windchimes, incense holders, pig-heads: all are equally good candidates.
Anecdote time:
While working on Gears 4 I was tasked with intensifying all of the tree, bush, and vine animations in our game so that they looked better in hurricane level winds. This work I basically redid in Gears 5, and has mostly survived into Hivebusters. What this did though, was teach me all the ways you can make things look like their moving in the wind, and I learned a very valuable lesson from this.
<aside> đŸ’¡ Trees blowing in the wind look a lot like hanging pendulums.
</aside>
Why this is might be a bit counter-intuitive. In a pendulum: the return to the center is driven by gravity, as the pendulum moves through its arc, it returns to the center because gravity is always pulling down. This slows the speed of the pendulum, stopping its forward velocity and reversing it.
For a tree, standing straight up, but getting blown over in the wind: what returns it to the center? Elasticity. The tree has grown straight up and has built in material elasticity that keeps it from falling over. When a great buffet of wind blows forward, it might bend the tree over, but unless the wind is continuous or strong and consistent enough to overcome the elasticity and replace it with plasticity, the tree will return to its upright shape.
These are the same effect, only the speed and consistency of a hanging object returning to the center is more consistent than a tree trunk.
Let us focus on pendulums now, but keep in mind how these same behaviors might be used for something standing upright too.
The behavior of a pendulum seems complex but it can be broken down into a few parts.
First there is the primary rotation. This is the behavior of the pendulum in a vacuum. nothing causes the pendulum to slow down along its length, so the whole thing rotates as if it were a rigid rod. In a vacuum, the speed of the pendulum on earth would be directly tied to how much it rotates. But, no one cares about facts and no one wants a pendulum in a vacuum, so screw that. We will always just pick a good looking believable speed.
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/bcc82235-98ed-4b9d-8375-f6b4b8ce37d0/at_tut_hanging_rotate.mp4
First we need to just get a sine wave going, we need to get values for rotating back and forth.
For convenience, and because we'll need this same setup a few times, I've made a function just to wrap a sine wave and do some period and offset functionality. In this case it is called tutorial_wave.