[solved] LensFlare and Culling

i have a question / problem with TestLensFlare.

It seems i can't set CULL_NEVER to a LensFlare Effect.

I tried setting setCullMode(SceneElement.CULL_NEVER) on the rootNode, the LightNode, the LensFlare itself, but the Flare always disappears when i move too far away from it.

As i understand it, if CULL_NEVER ist set on a Node, then this Node should always be visible, no matter how far the Frustum of the camera is set, right ?


There are two types of culling. Scene culling and polygon culling. setCullMode gets a CullState.CS_BACK, CS_FRONT, etc. This is to cull polygons, so no wonder why this is not working.  :stuck_out_tongue:

Check http://www.jmonkeyengine.com/jmeforum/index.php?PHPSESSID=8425712182145ca5a1b316bbfccdb021&topic=5084.msg41040 for more info…

I think this causes enough confusion so that perhaps an Enum should be used instead (?) to avoid name collisions.

hmm sorry but i don't understand.

A LensFlare is a SceneElement. And the LensFlare vanishes as soon as it moves further from the Camera than Frustum Far is set to (1000 units).

So, LensFlare.setCullMode(SceneElement.CULL_NEVER) should be valid no?

hmmm is anyone able to modify the TestLensFlare class, so that the Flare always is visible?


i have the opposite problem, my lens flares are always visible, even when they're not onscreen (I know that sounds stupid).

hehe darn, this is bugging me stll. I don't know if i do something wrong or if its acting buggy.

I added a


at the end of TestLensFlare.

If i move the camera backwards until they move out of the view frustum, the Flare and boxes still disappear suddenly visually.

But the stuff is being drawn, as the statistics show (and i verified it with debugging, that draw() is being called.

So my question is, why do the statistics show the stuff being rendered, but it still disappears suddelny when the stuff moves out of the view frustum (both the Flare and Boxes)?

I have had similar problems…

Try reading this topic, it could be relevant:


BoundingSphere dosen’t help with my issue, its still acting the same.

Also all elements in the Scenegraph including the root node have CULL_NEVER set.

Maybe its just me not understanding this View Frustum / Culling stuff.

But if the cull hint is set to never, the following should not happen right?

(Frustum Far set to 100)


now when i think more about it…

Nothing will make an object magically appear once it is outside of the view frustum right ?

So without setting CULL_NEVER the objects will not be processed at all if they are completely outsite the view Frustum.

if CULL_NEVER is set, the will still be processed (meaning onDraw() is called), but it still won’t be actually drawn because they are outside the view frustum.

Is this right ?

If you have a look at the Renderer code, you would see that setCullMode precisely does that… It sets the intersection with the frustum to be always true (inside)! so this is not the case…

However, the cull mode is not inherited (from what I recall), so you should set it in each Spatial.

Well the onDraw() Method of Spatial does the following:

 public void onDraw(Renderer r) {
        int cm = getCullMode();
        if (cm == SceneElement.CULL_ALWAYS) {
        } else if (cm == SceneElement.CULL_NEVER) {

If CULL_NEVER is set, then draw() is called.
But since the box is outside of the Cameras view Frustum, it still won't be visible, right?

So, as i understand it, CULL_ Hints are just there to avoid unnecessary draw() calls.

I need this cleared up, or my head explodes soon  :)

It is not drawn, but it is still processed and should show in the statistics… try setting the cull mode to NEVER for the individual spatials.

ah, so then we agree.  :slight_smile:

initially I thought that with CULL_NEVER i can make things appear always, but thats not the case.

And now i think i understand why. (which i described with the 'edit' in the post with the screenshots).