Hi, I’m having a problem with the Z-ordering of my lens flare effect. I’ve pretty much copy-pasted the lens flare code from the TestLensFlare-application, but unlike that application, my lens flare seem to appear on top of everything else, with the exception of the terrain.
Here’s a screenshot where the lens flare shouldn’t be visible because the origin of the lens flare is directly behind the tree.
It's a guess, but maybe your palm tree doesn't have boundings? (lensflare casts a ray to see if there is anything inbetween it and the camera, and that needs boundings)
Appearently the tree has a *huge* bounding sphere:
But it doesn't block the lensflare effect. I've tried applying other types of bounds using .setWorldBound( new BoundingBox() ) and .updateWorldBound(), but without any effect, the bounding sphere is still used. :(
if the tree is a Node your loading it as a model I'm assuming… use the loader properties to set the boundings.
As far as the occlusion, I'm not sure off the top of my head. It's either failing at the initial pick or the checkRealOcclusion check in LensFlare. If you are working with jME source, you can put some checks in the draw and checkRealOcclusion methods to determine where it's failing to find the tree.
As mojo said, it'd help a lot if you can tell us wether the method checkRealOcclusion() in LensFlare.java is ever called (put a breakpoint there or something). If it does get called, we can be pretty sure the problem isn't with the boundings, and focus on other things.