How LensFlare hiding works?

Started by Wojtek, February 07, 2010, 01:50:48 AM

Previous topic - Next topic

Wojtek

Hi,

I was playing a little bit with the LensFlare class. It i a very nice feature :)
I see in the documentation that it is possible to enable hiding of that effect when there is something on a way between camera and light source (in fact it is enabled by default). During my play with that effect I was not able to achieve that and I was even able to see the same behavior on a terrain demo...
The first image shows the sun and lens flare effect:

When I hide behind mountain, the effect is still applied:

Is is a correct behavior? And if yes, how the hiding feature works?

Thanks,
Wojtek

EgonOlsen

The terrain demo doesn't make use of this feature. To use it, you have to enable it in the lens flare class and the potential blocker object has to have the correct collision mode set (Object3D.COLLISION_CHECK_OTHERS). The algorithm simply casts a ray from the sun to the viewer (or vice versa, depending on the mode). If something blocks the ray, the lens flares will be turned off.