So I recently came across a really neat article by Mark Shingleton where he automated the exposure of a layer with the exposure of another layer. This type of automation could be a huge timesaver, especially when creating light spills from a lightning storm or muzzle flash.

Basically what this expression does is it analyzes the luminance of a layer every single frame and spits out a value that can be used by another layer (in this case, the exposure). Here’s the code as provided by Mark:

exposure = effect("Exposure")(3);
multiplier = 2;

driverLayer = thisComp.layer("MuzzleFlash");
samplePoint = [0,0];
sampleSize = [1280,720];

lightnessSample = driverLayer.sampleImage(samplePoint,sampleSize);
driverLightness = rgbToHsl(lightnessSample)[2];

exposure = driverLightness * multiplier;

As Mark stated, don’t hesitate to play around with the expression! Feel free to modify and change it up to suit your needs, if you need a strong effect, try playing with the “multiplier” value.

Many thanks to Mark for sharing his discovories and a thanks to Sam from Corridor Digital for sending me this screenshot. How would you guys use this expression? Got another tip to add that would make this expression even more useful? Let us know by dropping a comment down below.

2 thoughts on “Automated Light Spills with Muzzle Flashes & Expressions

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2022 Creative Dojo | All Rights Reserved.