godotengine / godotengine/godot

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

Open
#98,655 6 comments 8 reactions 0 assignees View on GitHub
discussion topic:3d topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

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+19`m)**. Most often related to overflows in length calculations and normalizations of 32 bit vectors.

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

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

## Issues list
### Scene
- [ ] 🪐 Rendering fails when zfar > ~1e+6 times znear (#99986)
- [ ] 🪐 #55070 (#99986)
- [ ] 🪐 Camera far distance is limited to `1,000,000` in editor (#100896)

### Lighting
- [ ] 🌌 Very far away point lights get culled (#98641)

### Shadows
- [x] 🪐 #81877
- [ ] 🪐 Dual paraboloid texture may have [NaN values](https://github.com/godotengine/godot/blob/7e99e939870fc149e42d2a76b764072f550f4b82/servers/rendering/renderer_rd/shaders/effects/cube_to_dp.glsl#L80-L83) for lights with very long range when [blit from cubemap](https://github.com/godotengine/godot/blob/7e99e939870fc149e42d2a76b764072f550f4b82/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp#L2621-L2623).
- [x] 🪐 #92551 (#100319)
- [x] 🏞️ #96361 (#100319)

### Shading
- [ ] 🌌 `VIEW` is `NaN` on very far away fragments
- [x] 🪐 #86275

### Geometry
- [x] 🌌 Very large built-in sphere primitives have wrong normals (#98610)

### Effects
- [ ] 🌌 #99967 (#104120)
- [ ] 🪐 #42390
- [ ] 🪐 Bokeh DOF blurs the whole screen when zfar > ~1e+6 times znear (#99755)
- [ ] 🪐 No SSS when zfar > ~1e+6 times znear (#99755)
- [ ] 🪐 No SSR when zfar > ~1e+6 times znear (#99693)

Contributor guide

Open the contributing guide

Research direction

This is a broad tracker rather than a standalone task. Start with one unchecked rendering issue, such as the dual-paraboloid NaN case, and read servers/rendering/renderer_rd/shaders/effects/cube_to_dp.glsl plus the referenced blit code in servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp. Done means isolating and resolving one listed issue with appropriate verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.