Lens flare occulsion

Is there any way to get the lens flare to render behind opaque objects such as ships and planets? I'm using a lensflare for my sun and it just shines through everything. I've fiddled around and tried to change the render queue to opaque just to see if that would work, but nothing seems to have any impact.



What am I missing?

No…  What you'd really want is occlusion that would turn off all of the flares when the light source is behind something.  It would look just wrong if some of the flares still showed, or especially if part of them did.



occlusion testing was planned but would require some kind of depth test or cast a ray out and see if it hits anything before it hits the light source.

renanse said:

No... What you'd really want is occlusion that would turn off all of the flares when the light source is behind something.


Didn't Irrisor add another constructor for the LensFlare that took a Node, for this purpose?

Not sure…  if so, it was likely a ray cast solution.  But to do it "right" you'd actually need to test if the entire object casting the light was occluded, not just a single ray cast towards the center of the object.  For pinpoint lights though, it could work ok.

Yes, the occlusion test in LensFlare is a ray test. Several rays are cast to fade the flares out in steps.

Simply use the ctor which you can provide with your scene root node.

(check TestLensFlare for code example / demo)

It seems that the current detection with the rays does not work right everytime:

http://jack-port.de/Uploads/Bilder/TestLensFlare01.jpg

Sometimes in certain camerapositions the flare shows up even though the camera is behind the terrain or my charactermodel.

That's true - there are issues with the collision detection. Nobody has found time to deal with them, yet…

Here's a strange thought…this actually goes against a great deal of what I have previously stated about the physics engine, but what about the idea of using the physics engine's implementation to do collision detection?



darkfrog

ODE doesn't have triangle precision (at least from what I've been told). Which is what Irrisor uses for the occlusion. (And where we have a couple bugs, dropping triangles). Not to mention there are plenty of uses for collision other than physics.

Man, I'm not really liking the word ODE lately…I seem to be finding more that it can't do than what it can.



Makes me wonder how much effort would really be involved to write something better. :wink:



darkfrog

darkfrog said:

Man, I'm not really liking the word ODE lately....I seem to be finding more that it can't do than what it can.

Do you have any software that can do more than it cannot?!  :D


Makes me wonder how much effort would really be involved to write something better.

Some years, I think. But feel free to start right away ;)

But this definately drifts off the topic of this thread now...

Agreed, just venting frustration in an unrelated thread. :wink:



darkfrog