Limit-Theory-Redux / ltheory

Limit Theory Redux is a fork of the discontinued open-world space simulation game Limit Theory. We have made it our mission to continue the development of the ambitious Limit Theory project as an open source initiative.
Apache License 2.0
57 stars 7 forks source link

Render Error - Planets #29

Open Flatfingers opened 1 year ago

Flatfingers commented 1 year ago

Beyond a certain distance (about 1100 "km" in the build as of 2022/03/02), planets (and, presumably, stars if we implement those) stop displaying. As the large but distant object is moved to the center of the view, first its edge (e.g., atmosphere) stops being drawn, then the circular exterior edge gets smaller and smaller until the object is no longer drawn at all. Changing zFar and zNear (in Camera.lua) have had no obvious effect so far.

philip-uk commented 1 year ago

I can no longer reproduce this. When I saw it, it was definitely a graphical glitch. The planet did not just suddenly disappear. It would be modestly sized and I can't remember, but either turning away, or turning towards it would make it shrink to a singularity or expand to its correct size.

Maybe your Z changes have helped. If you are able to reproduce it in LTheoryRedux (or camera/renderer etc), then please let me know what tweaks I need in order to see it again.

Flatfingers commented 1 year ago

The size of the galaxy in the experimental build was changed back to 2e4, near Josh's original value of 1e4. This value is currently controlled in LTheoryRedux for Background Mode by the variables ./script/Config/App.lua:scaleSystemBack , and for Flight Mode by ./script/Config/App.lua:scaleSystemReal . Also, ./script/Config/App.lua:scalePlanetReal controls the size of planets. Making planets larger than 1e6 (to try to approximate real object sizes in our actual Solar system) also contributes to the problem of planets demonstrating the rendering problem.

The change back to a smaller star system was made in response to the concern you expressed that testers would be bothered by ships being "jiggly" in a larger-scale star system (see https://discord.com/channels/695088786702336000/695723947307827222/1083111699105730623). Ships being jiggly and planets that stop being rendered are both artifacts of having a star system in which objects can fit into an extent larger than about 5e4.

To reproduce the "planet disappearing" rendering problem -- which necessarily brings the "jiggly ships" problem back as well -- edit ./script/Config/App.lua and change the value for scaleSystemReal to 1e5 or 1e6 or anything larger.

dgavedissian commented 1 year ago

I just spotted this. By eye, it seems to me that the planet is intersecting with the nebula / stars as it's disappearing, which I'm guessing is being rendered using a skybox or skysphere?

I suspect the issue is that the skybox/sphere is writing to the zbuffer, which means that the skybox/sphere is actually rendering on top of the planet when it's sufficiently far away. That would explain why modifying znear/zfar had no effect.

If that's the case, the solution would be to disable zwrite when rendering the skybox/sphere.