Giter VIP home page Giter VIP logo

astigmatism's Introduction

Astigmatism

A script I wrote to emulate a light trails effect in Adobe After Effects.
Here's a demo video that I did, which utilizes the script.

Table of content

Description

Inspired by Max Cooper's Resynthesis video, I wanted to emulate the light trails effect which is featured throughout the video. I noticed the effect was pretty similar to what people with astigmatism see, thus I decided to name the project "Astigmatism". Although I've written the script that is needed to emulate the effect, you will need a solid understanding of Adobe After Effects in order to follow up, since a good part of achieving the effect is to experiment with the layers.

Installation

  • Add the source material (image or video) that you'll use for the effect. Rename it to MAIN.

  • Add a Lumetri Color effect to MAIN, to increase the contrast (The Lumetri effect will come in handy later).

  • Change the blending mode of MAIN to screen, also check the 3D layer checkbox.

  • Add a Luma Key effect to MAIN to further increase contrast.

  • Add a Camera layer and a Null layer to the composition. Rename the Null layer to Controls.

  • In Controls, add a slider effect, and rename the slider to Z-dist.

  • Duplicate MAIN and rename the duplicate to Copy.

  • On the Position property of the Copy layer, Alt+Click the stopwatch symbol to enable JS expressions.
    Add this expression:

thisComp.layer("Controls").effect("Z-dist")("Slider");
[position[0],position[1],z*(index-3)]

This expression makes possible for the frames to take values from the Z-dist slider on the Controls layer.
The array below manipulates 3 dimensions [x, y and z].

Now the composition should look like this:

Initial composition

  • Add 3 more slider effects on Controls layer, named Z-Rot, Z-Rot Start and Z-Rot End.
    As you can guess from the names, they respectively control the rotation, when the rotation starts and when it ends.

  • On the Z Rotation property of the Copy layer, Alt+Click the stopwatch symbol to enable JS expressions again.
    Add the code below:

zRot = thisComp.layer("Controls").effect("Z-Rot")("Slider");
zRotStart = thisComp.layer("Controls").effect("Z-Rot Start")("Slider");
zRotEnd = thisComp.layer("Controls").effect("Z-Rot End")("Slider");
laynum = index - 2;

if (laynum <= zRotStart)
	0
 else if (laynum >= zRotStart && laynum <= zRotStart +zRot)
 	(Math.pow((laynum-zRotStart),2) + (laynum-zRotStart))/2
 else if (laynum >= zRotStart + zRot && laynum <= zRotEnd)
    	zRot*(laynum-zRotStart-zRot) + (Math.pow(zRot,2)+zRot)/2
 else if (laynum >= zRotEnd && laynum <= zRotEnd + zRot)
    	zRot*(laynum-zRotStart-zRot) + (Math.pow(zRot,2)+zRot)/2 - (Math.pow((laynum-zRotEnd),2) + (laynum-zRotEnd))/2
 else if (laynum >= zRotEnd + zRot)
    	zRot*(zRotEnd-zRotStart)

On the first section of the code, each expression makes possible for the layers to get the values from the sliders with the same names on the Controls layer. The last one tells us the exact position of each layer in the sequence.
On the second section, I based the statement off of this equation:

Triangular Number Equation

By using this equation, the code can pinpoint where the layers are during the animation and the rotation increase or decrease will be gradual.
So, before zRotStart, the rotation remains 0.
If the layer is between zRotStart and zRotStart + zRot, the rotation will slowly increase.
If the layer is between zRotStart + ZRot and ZRotEnd, the rotation will increase constantly.
If the layer is between zRotEnd and zRotEnd + zRot, the rotation will decrease gradually.
Finally, beyond zRotEnd + zRot, the rotation stays fixed as before.

Now, the composition should look something like this:

Final composition

  • Add 2 more slider effects on Controls, rename them to Highlights and Shadows.
    The Controls layer should look like this now:

Controls layer

  • Keyframe Lumetri color Tone properties with the sliders (Contrast, Highlights and Whites with Highlights slider, Shadows with Shadows slider).

This pretty much sums up how to set up the code for the light trails effect.
Below I've written some notes regarding the customization of the light trails effect by playing around with the values and the layers.

Notes

  • You will need images / videos that were taken at night with low lighting, since the multiple layers being rendered with the script won't translate well with footage that has too much light.
  • The rendering time will vary regarding the number of duplicated Copy layers you're gonna add to the composition.
  • Duplicate the Copy layer as much as you want and experiment with the sliders, blending modes and opacity of the copied layers.
  • Play around with the Camera properties to add further motion and a sense of flow to the composition.

astigmatism's People

Contributors

hansibalen avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.