Skip to content

Commit 1ea54f4

Browse files
committed
Add support for large z-far
1 parent 7628f87 commit 1ea54f4

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

tutorials/3d/3d_rendering_limitations.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ two different objects end up on the same buffer value, then Z-fighting will
7777
occur. This will materialize as textures flickering back and forth as the camera
7878
moves or rotates.
7979

80+
.. note::
81+
82+
The Forward+ rendering method uses a technique called *reverse-z buffer* that
83+
cancels out any risk of visible Z-fighting in most situations. This allows
84+
rendering both closeby any (very) far away geometry by pushing Camera's node
85+
**Far** property to (very) large values, while keeping **Near** property to its
86+
defaults.
87+
8088
To make the depth buffer more precise over the rendered area, you should
8189
*increase* the Camera node's **Near** property. However, be careful: if you set
8290
it too high, players will be able to see through nearby geometry. You should

tutorials/performance/optimizing_3d_performance.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ Large worlds
157157
If you are making large worlds, there are different considerations than what you
158158
may be familiar with from smaller games.
159159

160-
Large worlds may need to be built in tiles that can be loaded on demand as you
161-
move around the world. This can prevent memory use from getting out of hand, and
162-
also limit the processing needed to the local area.
160+
Even though Godot has the ability to render any far away geometry, large worlds may
161+
need to be built in tiles that can be loaded on demand as you move around the world.
162+
This can prevent memory use from getting out of hand, and also limit the processing
163+
needed to the local area.
163164

164165
There may also be rendering and physics glitches due to floating point error in
165166
large worlds. This can be resolved using :ref:`doc_large_world_coordinates`.

tutorials/physics/large_world_coordinates.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The range and precision (minimum step between two exponent intervals) are
4444
determined by the floating-point number type. The *theoretical* range allows
4545
extremely high values to be stored in single-precision floats, but with very low
4646
precision. In practice, a floating-point type that cannot represent all integer
47-
values is not very useful. At extreme values, precision becomes so low that the
47+
values is not always useful. At extreme values, precision becomes so low that the
4848
number cannot even distinguish two separate *integer* values from each other.
4949

5050
This is the range where individual integer values can be represented in a
@@ -152,8 +152,10 @@ Who are large world coordinates for?
152152
------------------------------------
153153

154154
Large world coordinates are typically required for 3D space or planetary-scale
155-
simulation games. This extends to games that require supporting *very* fast
156-
movement speeds, but also very slow *and* precise movements at times.
155+
simulation games when they involve both very large distances or object sizes
156+
*and* small and precise positions at the same time. This extends to games that
157+
require supporting *very* fast movement speeds, but also very slow *and* precise
158+
movements at times.
157159

158160
On the other hand, it's important to only use large world coordinates when
159161
actually required (for performance reasons). Large world coordinates are usually
@@ -164,6 +166,12 @@ actually required (for performance reasons). Large world coordinates are usually
164166
- Games with large worlds, but split into different levels with loading
165167
sequences in between. You can center each level portion around the world
166168
origin to avoid precision issues without a performance penalty.
169+
- Games with large-scale worlds, involving only large objects and speeds.
170+
As long as you don't need small-scale control over the world you can stick to
171+
single-precision coordinates. This also means that you can keep using real scale
172+
physical distance and speed units even in (very) large worlds.
173+
- Games with (very) far away geometry that the player can never reach. You can
174+
increase Camera node's **Far** property enough to get that geomertry rendered.
167175
- Open world games with a *playable on-foot area* not exceeding 8192×8192 meters
168176
(centered around the world origin). As shown in the above table, the level of
169177
precision remains acceptable within that range, even for a first-person game.

0 commit comments

Comments
 (0)