Terrain Disappears when Specific object leaves field of view?

I have a strange issue with my game:

As you can see in the video, when the house leaves the field of view, the terrain goes black, I’m not sure what could cause this. I have attached the trees to a node, and the building to a node:

[java]buildings = new Node();
treeNode = new Node();

I then attached those Nodes to another Node and attached that node to the rootNode:

[/java] selectables = new Node();

After doing that, i add objects to both the treeNode and the Buildings node, which are both contained within the selectables node. I’m not sure if this is causing an issue, but i thought it may help.

Any ideas? Or need more code?

Thank you for You time :slight_smile:

Ah you have a shadow renderer/filter,

what happens if you remove it? (I think you might only see the shadows, but not the terrain)

1 Like

Yes, if i remove the shadowRenderFilter, the terrain is gone. Strange. Do you have a solution?

I cant thank you enough your your time :slight_smile:

What happens if you run this?

void exportNodeTree(final Spatial rootnode, final String string) {
final JFrame frame = new JFrame("SceneGraph: " + string);
final DefaultMutableTreeNode masterdescriptor = new DefaultMutableTreeNode(string);
final JTree tree = new JTree(masterdescriptor);
frame.add(new JScrollPane(tree));
this.addAllChilds(rootnode, masterdescriptor);

private void addAllChilds(final Spatial current, final DefaultMutableTreeNode descriptor) {
	final BoundingVolume wbound = current.getWorldBound();
	String bs = " Bounding: ";
	if (wbound == null) {
		bs += " none!!!";
	} else {
		if (wbound.getType().equals(Type.Sphere)) {
			final BoundingSphere bss = (BoundingSphere) wbound;
			bs += "Sphere:" + bss.getRadius();
			bs += "center:" + bss.getCenter();
		} else {
			final BoundingBox bss = (BoundingBox) wbound;
			bs += "Box:" + bss.getMin(null) + " -> " + bss.getMax(null);
			bs += "center:" + bss.getCenter();

	if (current instanceof Geometry) {
		bs += " ignore = " + ((Geometry) current).isIgnoreTransform();
		bs += " batched = " + ((Geometry) current).isBatched();
		final BoundingVolume lbound = ((Geometry) current).getMesh().getBound();
		if (lbound.getType().equals(Type.Sphere)) {
			final BoundingSphere bss = (BoundingSphere) lbound;
			bs += "LSphere:" + bss.getRadius();
			bs += "Lcenter:" + bss.getCenter();
		} else {
			final BoundingBox bss = (BoundingBox) lbound;
			bs += "LBox:" + bss.getMin(null) + " -> " + bss.getMax(null);
			bs += "Lcenter:" + bss.getCenter();

	final DefaultMutableTreeNode bdescr = new DefaultMutableTreeNode(current + " lpos:"
			+ current.getLocalTranslation() + " wpos:" + current.getWorldTranslation() + " cullhint:"
			+ current.getCullHint() + " Tris:" + current.getTriangleCount() + bs);
	if (current instanceof Node) {
		final Node node = (Node) current;
		for (final Spatial child : node.getChildren()) {
			this.addAllChilds(child, bdescr);


1 Like

Where do i run this?

I Implemented it into my code. But how do i use this?
Do i call this in my initialize? And with what?

Sorry for many questions.

just call it in the first frame with your rootnode as argument, and a name (whaterver you want, I have internally multiple scenes, so i need that ^^)

1 Like

So i call exportNode tree on initialize, and call add all childs when i add a child?

Ok ill post my results. Thank you very much :wink:


The Tree Node and The Building Node say null? Is that an issue?

Mhh your guiNode is attached to the rootNode?
That may cause all sorts of issues

the null is just the name of the node,
but yes the gui nodes seems a bit problematic i guess.
Else than that the bounding box of the terrain itself looks fine, so iut must be something else.

I didnt have a texture applied to the terrain, so for some reason that caused the issue

Still, you should be extremely super very much absolutely concerned that your guiNode has somehow ended up as a child of the rootNode. It’s a huge bug somewhere in your code that will cause you all kinds of issues later.

I fixed that. It was because i wrote the code to attach something to the root node, and it auto completed to the gui node and i forgot about it.

Thank you all so much for your time