I recently entered a crazy video competition with some friends. The theme was to bring an outdoor activity inside – and what better outdoor activity is there than a good old Duck Shooting session – with machines guns – in the house.
The competition has now finished and it looks like we attained a really nice third place! To check out the actual video please go here.
While putting this together I wanted to add the muzzle flashes to the guns and also some exposure hits when the muzzle flashes went off. I was already key framing the muzzle flashes and I didn’t want to key frame exposure hits as well. This got me thinking about expressions and how I could use the ‘brightness’ of one layer to drive a value in another layer.
I did a bunch of research and here’s what I came up with.
exposure = effect("Exposure")(3); multiplier = 2; driverLayer = thisComp.layer("MuzzleFlash"); samplePoint = [0,0]; sampleSize = [1280,720]; lightnessSample = driverLayer.sampleImage(samplePoint,sampleSize); driverLightness = rgbToHsl(lightnessSample); exposure = driverLightness * multiplier;
How it works
So – for this to work you need a single layer with the muzzle flashes – the way I created the muzzle flashes was to buy Video Copilots Action Essentials kit – then I timed the flashes to the underlying video clip – when I had the flashes timed up (I think there were about 5 for this shot) – I then selected all the muzzle flash layers and pre-composed them into a new comp called ‘MuzzleFlash’.
Then I added an adjustment layer above everything and applied the exposure effect to that. You then twirl down the effect properties and add the expression above to the “Master / Exposure” property.
Now be warned – it can take a while to compute. What it basically does is, every frame, it works out the average luminance of the entire Muzzle Flash clip – it then returns a number which we can use to drive our exposure value.
I added the multiplier into the expression so I could get a little more control over the intensity of the exposure hit.
I also found this worked really well as I could duplicate the exposure layer and mask off parts of the actor or surfaces that might be even brighter still – that gave a bit more of an illusion that there really was light emitting from these flashes and lighting up the scene.