Bad wicked evil naughty culling

Okay, so it’s probably not really culling’s fault, but rather my own, but I didn’t really feel like bashing myself at the moment.

This picture is just fine:

But I move the screen down just slightly:

Then the sun is gone…what’s up with that?  It seems to be pre-culling items off the screen sometimes before they’re actually off the screen…

Any ideas?

  1. What are we looking at?
  2. How are you setting up your bounds in the scene?
  3. Are you making use of any CULL flags?
  4. What is your update loop doing?
  5. What is the parent of the item that is disappearing?
  6. What is the world bound of that parent?
  1. A scene (using StandardGame) with a Node containing a Sphere (for the sun) and a loaded model (for the ship).  There is a skybox that is locked to the camera position (the stars).  The InputHandler is a FirstPersonHandler.
  2. Sun - setModelBound(new BoundingSphere()); Ship - setModelBound(new BoundingSphere());
  3. The only culling flags are on the skybox: skybox.setCullModel(Spatial.CULL_NEVER);
  4. The update loop for this game consists of the following (this is for my gamestate, the update loop for StandardGame is doing the rest):

        // Synchronize stars to the camera position
        // Update the InputHandler
        // Update the geometric state of the rootNode
        rootNode.updateGeometricState(tpf, true);

5. The parent of the item that is disapearing (the sun) is the rootNode (Node)
6. ....I just instantiated the rootNode, so whatever the default is.

My sun as it exists now:


import java.util.concurrent.*;

import com.jme.bounding.*;
import com.jme.image.*;
import com.jme.math.*;
import com.jme.renderer.*;
import com.jme.scene.shape.*;
import com.jme.scene.state.*;
import com.jme.system.*;
import com.jme.util.*;

public class Sun extends Sphere {
    private static final long serialVersionUID = 1L;

    public Sun() {
        super("Sun", 50, 50, 50.0f);
        AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
        MaterialState ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
        TextureState ts1 = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        Texture t1 = TextureManager.loadTexture(getClass().getResource("/data/firetile1.jpg"), Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);
        t1.setTranslation(new Vector3f());
        setModelBound(new BoundingSphere());
        GameTaskQueueManager.getManager().update(new Callable<Object>() {
            public Object call() throws Exception {
                return null;

I don't see an updateModelBound() call on the Sun?

You are correct, and that was the problem. :slight_smile:

Thank you very much.  I didn't realize updateModelBound() was required after setModelBound was called.

updateModelBound "resets" the set bound to best contain the object. This call is required as to not automatically override a set bound. As it is possible you are setting up custom bounds on objects.

I have something very very similiar…

  1. A scene with a node attached to the rootnode (zbuffer set on root node) that has a ship attached to it.  SkySphere, a skybox but with geosphere instead, locked to camera position.  InputHandler is FPSHandler.
  2. Ship - setModelBound(new BoundingSphere());
  3. Same as DF's
  4. Same as DF's
  5. Same as DF's

    Except my problem is that when I turn 90 from the intial direction the skybox disappears.  If I don't use a boundingsphere then it works ok.

n/m, issue with skysphere not having a boundingsphere attached.