Objects appear to disappear "behind" panorama sky at range 500. What setting am I missing?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Charlie

Godot 3.0.2-stable project.

I have a solar system simulator with some planets and orbit paths. I set Camera.far to a large value. When my Environment Background is set to “clear color”, planets and orbit paths are visible at large distances. If I set Background to “sky” (but add no texture yet) everything is still OK. However, when I add my star field texture to the sky, I can no longer see anything farther than about 500. Both planets and orbital lines are visible when distance <500 and disappear when >500. It appears as if objects disappear “behind” the star background texture at range 500.

Can someone tell me how to fix this?

Sorry, not a solution here - I’m using the Simple Skybox tool, which may be quite different from what you are doing, but is giving me the exact same behavior. Did you ever figure anything out on this?

MisterAcoustic | 2020-05-08 22:14

:bust_in_silhouette: Reply From: Charlie

I did discover the answer to this. From experience in my astronomy simulation, it seems that Camera near and far properties are connected in some way. If near is too small, it will effectively decrease far. I believe they need to be within about 10 orders of magnitude of each other to work properly (e.g., near = 1e-5, far = 1e5, is OK).

The way I solved this limitation in I, Voyager is to dynamically change both near and far together based on camera distance to its parent. So in our camera code we have:

const NEAR_DIST_MULTIPLIER := 0.1 
const FAR_DIST_MULTIPLIER := 1e9

# then, in our every-frame process:
	var dist := translation.length()
	near = dist * NEAR_DIST_MULTIPLIER
	far = dist * FAR_DIST_MULTIPLIER

This allows us to view the solar system from afar (200 au) and to zoom in to small bodies, which is >> 10 orders of magnitude difference in scale. The only effect is when you zoom very close to a small body, then the orbit paths of distant planets will start to disappear. But that’s barely noticeable and almost looks intentional.