Rendering Problem With Skybox and Far Frustum Culling


I’m having a problem that began when I started using far frustum culling to improve performance. Previously, the far plane of the view frustum was set such that, as far as the viewer is concerned, one can see infinitely far. The skybox was scaled so that its boundaries were outside of the player accessible portion of the world, but before the limit of the view frustum (so that it would not be culled).

When I implemented far frustum culling, I set the far plane to be significantly closer to the viewer than “infinite” – approximately half the total distance of the accessible area. Afterwards, nothing I did seemed to allow the skybox to be visible (since its boundaries were outside of the frustum now) except for reducing its scale to lay within the frustum. However, reducing its size so significantly resulted in a very distorted relative speed between the skybox and the world – it appeared that the background was extremely near to the viewer. So, for now, the skybox is attached to the viewer and moves along with you, causing it to appear “infinitely” far away.

Unfortunately, two of these things together seem to have created an artifact – specifically, reducing the distance of the far plane, and reducing the scale of the skybox to fit within it (causing its far face/plane to often intersect at a perpendicular angle with the ground object, which is also a face/plane of a box). For some reason, this has caused pixels of the ground that are located toward the far frustum plane to disappear. The resulting artifact is that the parts of the world perpendicular to the jme y-plane (e.g., the ground) become invisible at far distances, whereas the parts of the world parallel to the jme y-plane (e.g., walls of buildings, trunks of trees) are clearly preserved. Whatever the underlying cause is, I have confirmed that the symptoms are resolved so long as the skybox is larger than the visible world – the problem only appears when it intersects the ground.

I’ve already tried significantly increasing the distance of the near plane of the view frustum, increasing the depth bits, and changing the render queue ordering of the skybox – none of these seem to solve the issue.

Here is a picture, for reference. You can see the skybox showing at the base of buildings in the distance. such as the wooden porch on the right side of the road on the furthest house, below the foundation of the blue house on the left side of the road, below the very tall gray building, etc. These areas SHOULD be showing grass.

Well this is embarrassing, but after trying “everything” I guess I still had one more thing to try. The code for the Skybox class sets the render queue mode to “Skip”, but that evidently only makes a reliable difference if you set the other objects to “Opaque”.

Setting the render queue mode of the root node of the world to “QUEUE_OPAQUE” solved this problem, and so it’s back to work for me.

The terms you use make me think you might not be using JME3. Are you using JME2 by any chance? If so that’s probably worth noting in the future as there aren’t many people using or supporting that anymore and you’ll at least narrow down your answers to those who might actually have relevant information.

JME3 doesn’t really have this sky problem because it has a sky bucket.

Sorry, I probably should have made that clear – you are correct. This project is being developed on JME2.