+2 votes

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?

in Engine by (106 points)

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?

1 Answer

+1 vote

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.

by (106 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.