Author Topic: How LensFlare hiding works?  (Read 2914 times)

Offline Wojtek

  • int
  • **
  • Posts: 62
    • View Profile
How LensFlare hiding works?
« on: February 07, 2010, 01:50:48 am »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How LensFlare hiding works?
« Reply #1 on: February 07, 2010, 09:14:31 pm »
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.