godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.38k stars 21.26k forks source link

[TRACKER] Rendering issues at very long distances (numerical precision) #98655

Open Flarkk opened 3 weeks ago

Flarkk commented 3 weeks ago

This is a tracker dedicated to issues experienced when rendering at very long distances, i.e. involving very large camera far distance, very large and very far away geometry, lights with very long range, and all kinds of very large numbers in general.

Such scenes are very common in space settled games, open words, at-scale planets, and similar applications. Godot currently offers a rather low level of support for such applications due to the many places numerical precision and overflow issues arise.

Sometimes these issues can be worked around with the double precision build, but many also involve numerical issues in the shaders as well, which makes having double precision in the core engine of little help.

Note : deep scenes rendering usually comes along with other related requirements like floating origin management, quadtree / octree scene partitioning or resource streaming. These are broader concerns that go beyond rendering and should not be tracked here.

Feel free to comment on this thread if you've identified or resolved issues not yet mentioned below !

Issues classification

🌌 : happens at galactic scale (numbers > ~1e+19m). Most often related to overflows in length calculations and normalizations of 32 bit vectors.

πŸͺ : happens at planetary scale (numbers > ~1e+6m). Most often related to numerical precision issues with near and far planes of 32 bit projection matrices

🏞️ : happens at walkable distances (numbers > ~1e+2m). Not deep scene issues strictly speaking, still mentioned because likely related

Issues list

Scene

Lighting

Shading

Far away fragments

Geometry

Effects

roalyr commented 3 weeks ago

I've gathered all my tweaks in a single commit for 4.x : https://github.com/godotengine/godot/compare/master...roalyr:godot-for-3d-open-worlds:master and for 3.x: https://github.com/godotengine/godot/compare/3.x...roalyr:godot-for-3d-open-worlds:3.x Just in case. I also think it is worth adding editor tweaks to the list (scene camera and in-game camera limits, editor zooming speed, grid and gizmos rendering precision, and so on).

Zireael07 commented 3 weeks ago

Nit: I'd change the title to be "very large", as "deep" usually refers to the scene tree's complexity