february 2024 | laboratory

Implementing and automating physics-like systems inside of After Effects using advanced expressions & scripting.

This laboratory post covers my experimentation with mimicking the physics systems of more advanced rigging software like Spine2D and Live2D. While After Effects is capable of rigging complex characters, it lacks a true real-time physics system. While we certainly can’t achieve real-time rendering inside of After Effects, we can try to mimic physics systems using advanced expressions & scripting.

Where After Effects lacks the ability to truly specialize in a certain area, it somewhat makes up for this with the power of expressions and scripting. On top of this, the ability of rigging inside of After Effects is determined mainly on the older, “legacy” engine, as it gives more control for where the pin/bones influence, allowing for more precise control, which I also experimented with this month.

Timeline: 1 Week (February 2024)

(breakdown pictured below)

Tools

Role

Photoshop

After Effects

Visual Studio Code

DUIK

Rigging

Animation

Visual Effects

Art Breakup

Layering

Compositing

Scripting


01 - full body rig

Overshoot editor

This overshoot editor is an extremely barebones script to change values within the expression without having to actually open and manually change each value.

This is just a simple quality of life script.

02 - scripting & automation

Reflection & Takeaway

While I think this was extremely fun and a great experience learning scripting & more in-depth expression creation, the ultimate outcome left me with mixed feelings.

While I did accomplish my goal of creating some sort of “physics system” After Effects’s limitations proved to be an issue, as no matter what, the hair can never react fully to the bulk of the rig, and the overshoot is only displayed in animation, not in the viewport. Meaning, you can never really know exactly what it will look like until you’re already spending copious amounts of time pre-rendering the animation. This makes me think, this script would have more impact in more general Motion Design videos for advertising or related fields, not character rigging & animation.

Regardless, I walked away with some super cool scripts, and more experience!

character rig

Full body rig with IK/FK.

(Created with puppet pins and DUIK)

(Illustration from Jyoji Morikawa, author of Hajime No Ippo)


overshoot expression

This video shows the “overshoot expression” (Created by Anthony Possobon) at work.

The drawback of this attempt at a physics system, was the absolutely tedious setup of, pinning the subject, creating layer pins, and then copy & pasting code over, and over onto sometimes 30+ layers.

This tedium gave me the idea to code a script to automate (or at least, ease the process)

Null creation script

This script, which creates nulls based on what layers are highlighted, with options for layer color, scale percentage, and automatic-parenting was a HUGE workflow improvement for me.

The original code that creates the nulls was created by Anthony Possobon, though the expression was heavily edited by me for the purpose of this script, as I needed (and added) coloring, scaling, auto-parenting, and the ability to create multiple nulls at once for workflow improvements.

Overshoot script

The overshoot script was created because the extremely tedious nature of apply an expression to numerous layers.

Admittedly, it’s still tedious.. but this is a MASSIVE improvement from copy and pasting the code over and over, limiting the process to a few button presses.

The base expression uses the value of time to calculate the amount of overshoot & drag, which then cascades down to each null (controlled by pins).

World space script

This was a script I created to apply an expression to a layer’s property, assigning it to “world space.” Which means said property will take the position of the layer in the comp regardless of what it’s parented to.

This is mainly found in Rigging, but can be used elsewhere to great benefit.