I am looking for a way to create a sunlike effect. Having a 3D comp and I want to create the illusion of the sun appearing behind buildings. Casting shadows would be a cool asset but the light it self is mainly what I am after.
I read this tutorial http://library.creativecow.net/articles/armstrong_trent/lensflare.php - but I can not seem to figure out how to do it with 3D layers.
You could just pre-compose the 3D-comp and apply your lensflare as a 2D comp effect. This would be the simplest way to approach the issue. if you wanna tie in the lensflare with a 3D light, you need layer space transforms:
This will however not take care of the fading, since sampleImage() works 2D only, so you would need to base your obscuration on the 2D distance to a given surface point. This involves some hocuspocus and even more layer space conversion, so I recommend you combine the 2 techniques: Use my code to reference your 3D light, but have the lensflare in your flattened 2D comp or as an adjustment layer.