(solved) CULL_NEVER is ingored for QUEUE_ORTHO

I am trying to put a quad as a minimap in rendering queue QUEUE_ORTHO, however the minimap disappears when no other 3d geometry is being displayed. Setting cull mode to CULL_NEVER seems to have no effect. Also setting model bounds seems to have no effect (this is probably useless for ortho queue, but i thought to try it anyway).

As a side note: my software mouse also disappears when there is no other geometry displayed.

Here is a test-case:

Turn the camera around, when the cube is not seen, the minimap disappears.

import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.scene.SceneElement;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;

public class CullTest extends SimpleGame {

   private Quad minimap;
   private float minimapWidth = 200;
   private float minimapHeight = 200;
   protected void simpleInitGame() {
      minimap = new Quad("myQuad", minimapWidth, minimapHeight);
      minimap.setLocalTranslation(minimapWidth/2 + 5, minimapHeight/2 + 20, 0);
        minimap.setDefaultColor(new ColorRGBA(ColorRGBA.white));
        minimap.getBatch(0).getDefaultColor().a = 0.5f;
        minimap.setModelBound(new BoundingBox());
        AlphaState as = display.getRenderer().createAlphaState();
        Box box = new Box("box", Vector3f.ZERO, 10, 10, 10);
        box.setModelBound(new BoundingBox());
        box.setLocalTranslation(0, 0, -50);
   public static void main(String[] args) {
      CullTest game = new CullTest();


i tried this code and compared it to very similar code i have…

the only difference is i am using BoundingSpheres…

when i uncommented

minimap.setModelBound(new BoundingBox());

and used BoundingSphere instead of BoundingBox the quad was always displayed ...
i've no idea why it doesn't work with BoundingBox..

Well, then it might be two bugs:

  1. the quad should never be culled because of CULL_NEVER modifier
  2. the quads might not be culled in a different setting when used with bounding boxes…

i can confirm the problem and the temporary solution.

in my case the lensflare was culled when it shouldnt be and that was just plain ugly. the bounding sphere is a first solution … but the bug has to be found at some point …  :wink:



cull hints (like never, always, etc.) are for the engine to use as it traverses your scenegraph.  I've bolded the key word here.  This is how a scenegraph works.  Setting something to cull never does not mean the engine will magically skip down the tree and pull out stuff that is set to cull never.  If you want such behavior, either force all parents of the node to also be cull_never, or break these sub trees out into their own scenegraph trees and work with them individually.

Ok… the quad is attached directly to the rootNode. So when traversing the graph, it should look at children's of the rootNode, see that one is set to CULL_NEVER and draw it at some point.

Also, how do you explain that when having a bounding box on the quad, it is still being culled? And why having a bounding sphere on the quad causes it to be drawn?? That doesn't make any sense. Either way you put it, there is at least one bug there.

Looks like the rootNode itself is being culled. The engine looks for the bounding volume of the rootNode which in this case corresponds to the bounding volume of the box. So when not looking at the box, the rootNode's bounding volume is outside of the view and the rootNode is culled.

And the bounding volumes do not work well with geometry that uses QUEUE_ORTHO (and yeah, they shouldn't)…

So… no bugs here :-o

Culling for ortho simply does not work, I guess. So don't attach ortho stuff to a normal scene node. Rendering an additional ortho node with culling switched off for the complete node works fine.

Yeah, for the SimpleGame it's possible to use the fpsNode, and attach all the ortho stuff to it. I guess that's why the fpsNode is there in the first place…

Yeah…  It's an interesting mental challenge to think how you would merge an ortho bounding and a 3d scene bounding…  (for me anyhow XD)  I'd rather just keep ortho and 3d separate anyhow.  Easier for me to manage.

irrisor said:

Culling for ortho simply does not work, I guess. So don't attach ortho stuff to a normal scene node. Rendering an additional ortho node with culling switched off for the complete node works fine.

Ortho culling is only based on the cull hint.  I suppose we could do 2d bounds and detect off-screen, but seems like a lot of work for something that is not going to happen all that much.