Last active
January 7, 2019 04:58
-
-
Save howiemnet/df25cb53537103fc8c4530d8b9acfb66 to your computer and use it in GitHub Desktop.
Blur objects at infinity depending on camera settings - After Effects expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This expression, applied to the blur radius of a Lens blur effect, will calc the right amount of blur | |
// to apply to objects at infinity (eg star fields) depending on the focus dist / aperture of the current active camera | |
// | |
// For safety it maxes out at 100 px (!) | |
// | |
try { | |
focLen = (thisComp.activeCamera.cameraOption.zoom * 102.05) / thisComp.width; | |
blurDiam = (focLen * thisComp.activeCamera.cameraOption.aperture) / (thisComp.activeCamera.cameraOption.focusDistance - focLen); | |
Math.min(100,Math.abs(blurDiam)/2) | |
} catch(err) { | |
value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment