Lens Flare on 3D Lights?

After Effects lights can be moved around in 3D space but a lens flare effect can only move in 2D space on the X and Y axis. So how can you add a 2d lens flare to a 3D moving light?

The secret is using a simple expression on the “Flare Center” of the lens effect.

1. Alt Click on Flare Center stop watch to add expression

2. Type this in the expression box:

thisComp.layer(“Light 1“).toComp([0,0,0]);

NOTE: Just change “Light 1” to the name of your light.

This tip can be found in the bump map tutorial around 6:15 for those who would like to see it in action. View Tutorial

Dan Ebberts has an ever useful “3D Lens Flare” case study on his website that includes distance falloff. Check that out.

Here is an anamorphic lens flare project too.

August 11th, 2009 @ 6:57 am
thanks for the tip
August 11th, 2009 @ 6:57 am
nice... always somehting useful :-)

thank u
August 11th, 2009 @ 7:01 am
Thanks for the tip.
August 11th, 2009 @ 7:01 am
thx andrew.
August 11th, 2009 @ 7:01 am
August 11th, 2009 @ 7:03 am
Thank you!!! I've always wondered how to do this, and never could figure out how! You ROCK!
jim hines
August 11th, 2009 @ 7:06 am
I'm digging this "written" quick tip things. Thanks.
August 11th, 2009 @ 7:09 am
Huh, I really need to take some notes when I watch these things. Totally forgot about that particular expression...
August 11th, 2009 @ 7:09 am
nice man! good stuff right there
August 11th, 2009 @ 7:10 am
The whole expressions thing is still a little over my head. Well Writing them that is.
August 11th, 2009 @ 7:44 am
nice tip thank you
August 11th, 2009 @ 7:45 am
Sweet, this should come in handy soon!
August 11th, 2009 @ 7:45 am
Good Tutorial Andrew !
August 11th, 2009 @ 9:22 am
Em andrew is this ment to replace the orb we made in the tutorial or add on top of it??

It looks class btw! :)
August 11th, 2009 @ 9:26 am
I figured it'd be scaling the size to match the distance on that axis.
Anthony Breslin
August 11th, 2009 @ 9:43 am
Aww just did it there. Class!

Thankyou Andrew Kramer once again ha :)
August 11th, 2009 @ 10:20 am
August 11th, 2009 @ 10:30 am
Hey Buddy nice tip.

but i must say here that you have already mention this expression in your BUMP map tutorial as well and i think your another tutorial too.

well here is another expression which do the same thing.
August 11th, 2009 @ 10:52 am
THX :D hope it will help me and someone else in future
August 11th, 2009 @ 11:00 am
I remember seeing that before. Thanks for the refresh! :)
August 11th, 2009 @ 12:44 pm
thank you Sir
August 11th, 2009 @ 2:20 pm
I've always wanted to know how to do that :D
August 11th, 2009 @ 2:28 pm
Nice tip. Thanks.
August 11th, 2009 @ 2:36 pm
Hi, thks so much for the tip, also for all the help...

PS: My regards to Sam, I feel sorry for him.

Js´ Andrew you have:
CRASH the guy, Throw it to the floor, Blast him, Stab him, Send it to God knows where, Put it into a fight, converted to some kind like a alien, disintegrated, blow him up, freeze the pour guy to death, bug him, make him almost one of the 10 terrorist most wanted… What else you going to do to the unfortunate human being called “Sam”….

August 11th, 2009 @ 2:55 pm
That's certainly very cool. Thanks for the tip!

I wonder if AE CS5 will have real 3d lens flares? :D
anvir tahini
August 11th, 2009 @ 3:17 pm
Brett Perry
August 11th, 2009 @ 3:23 pm
Thanks Andrew,
Just a quick note that I'm sure most people have already figured out. You can use this on other 2D effects as well. Use two 3D nulls and a layer with the "beam" effect applied and the above expression using connecting one null to the start point and one to the end point. Add a camera and move the nulls in 3D space and then rotate the camera - ahh the beam in 3D. I've used this trick with the center point of Trapcode's Shine on projects as well. GO AEing today.
August 11th, 2009 @ 3:26 pm
Sometimes I really do worry about Andrew's Lens Flare fetish
August 11th, 2009 @ 3:41 pm
Thanks Andrew, very useful tip
Kevin Lee
August 11th, 2009 @ 5:19 pm
Thanks Andrew for the tip.

Hey Brett, that sounds like a great tip. Is there somewhere I can learn that a bit more in depth?
August 11th, 2009 @ 6:52 pm
could you transfer this to other plug ins like cc particle world and if soo what would you use as the "flare center".
Matthew Sabia
August 11th, 2009 @ 7:17 pm
Thanks that's really usefull ;)
August 12th, 2009 @ 12:11 am
hey can you make a preset for anamorphic lens flares?
August 12th, 2009 @ 12:59 am
Thank you so much Andrew,
You always have something new and exciting to share with us. Im soon going to purchase action essentials 2, and thanks to you I will be creating awesome composites, with your elements I have ideas that probably no one has ever though of in my own twisted way which you encourage us to do as always. I really do appreciate everything you have done for us all.
Thanks Again.

-Brandon Lagenour
-Revolutions Designs
August 12th, 2009 @ 5:51 am
very nice tip! thanks a lot
Brett Perry
August 13th, 2009 @ 10:23 am
Hi Kevin,
I can't remember where I saw the tip or tutorial, although I suspect it was from John Dickensons' Motionworks web site. If you're really interested, send me your e-mail address and I'll send you a project file for you to check out that will show more detail than I can describe here. Hey, us AE nuts gotta stay together.
August 13th, 2009 @ 3:49 pm
thnx a lot!
August 14th, 2009 @ 1:18 am
nice tips .. andrews better 2 experiment now with this new tips..
Kevin Lee
August 15th, 2009 @ 2:48 am
Thanks Brett Kdawg925@gmail.com Just love to learn those little tips.
August 15th, 2009 @ 1:05 pm
I've tested that trick after seeing the bump tutorial but for having much control of my flare i didn't use the classic lensflare fx but one from the genart's saphire wich allowed me to use the point of interest of my light to control the lenflares artefacts are moving.

So now I have a lensflare which follow exactly my light.
The Rover
August 15th, 2009 @ 4:31 pm
Great !

Can this somehow work with Advanced lightning?
omid akbari
August 16th, 2009 @ 6:35 am
Thanks for the tip
August 16th, 2009 @ 11:19 am
Thank u Andrew! ;)
August 17th, 2009 @ 10:02 am
thanks man. its really a cool tip.you folks have been helping me alot.
tyrone the bamboozle
August 18th, 2009 @ 4:33 am
goood yall good gravy yall this is the fanatabulos i am likin it much okay bybey!
March 18th, 2010 @ 1:57 pm
MMM,, I have a problem whith this expression. Im importing a 3d camera form 3dMax whith MAX2AE.... the imported 3d camera must have the AUTOORIENTATION OFF.... and wen this option is active on any After Effect camera, the expression not work......

any idea??.. thanks man, you rally are the zen master of this stuff.

hugo, from Chile
August 20th, 2010 @ 6:22 pm
Andrew... gotta tell you. My 2 sons (7 and 9) have been watching your tutorials with me. Today my youngest was watching the 3D lens flair tut with me and when you got to the semicolon at the end of the expression, he said emphatically (with a 4 missing front teeth lisp)... "HE'S GOOD!! Did he go to school a lot?". I replied "He IS the school".

Anyway... seems your impressing even the youngest of audience and hopefully some future compositors.

Keep cookin'
August 20th, 2010 @ 6:23 pm
Oh! He also thinks your saying "butt mapping".... awesome!
October 7th, 2011 @ 6:35 pm
thanks for ur help
Theo K..
May 26th, 2012 @ 10:38 am
This expression is incredibly helpful. I'm inspired to start learning more about expressions also. Thank you so much.
May 19th, 2013 @ 11:28 am
Thanks! This tips helps me out a lot!
August 20th, 2013 @ 1:16 am
Every time I try to do this I get an "After Effects warning: Syntax error Expression disabled."

This expression seems like it should be simple enough to do? Anyone else getting this problem??
May 17th, 2014 @ 4:04 pm
Can you parent the light on the flare's position?
Can I change 'z' without changing the 'x' and 'y'?
Please reply!!
Before Posting
We're trying to encourage more thoughtful commenting.  Please take a moment to write a meaningful response to this post.
* Name
* Email (will not be published)
* field is required