Up to date
This page is up to date for Godot 4.1
.
If you still find outdated information, please open an issue.
Large world coordinates¶
Note
Large world coordinates are mainly useful in 3D projects; they are rarely required in 2D projects. Also, unlike 3D rendering, 2D rendering currently doesn't benefit from increased precision when large world coordinates are enabled.
Why use large world coordinates?¶
In Godot, physics simulation and rendering both rely on floating-point numbers. However, in computing, floating-point numbers have limited precision and range. This can be a problem for games with huge worlds, such as space or planetary-scale simulation games.
Precision is the greatest when the value is close to 0.0
. Precision becomes
gradually lower as the value increases or decreases away from 0.0
. This
occurs every time the floating-point number's exponent increases, which
happens when the floating-point number surpasses a power of 2 value (2, 4, 8,
16, …). Every time this occurs, the number's minimum step will increase,
resulting in a loss of precision.
In practice, this means that as the player moves away from the world origin
(Vector2(0, 0)
in 2D games or Vector3(0, 0, 0)
in 3D games), precision
will decrease.
This loss of precision can result in objects appearing to "vibrate" when far away from the world origin, as the model's position will snap to the nearest value that can be represented in a floating-point number. This can also result in physics glitches that only occur when the player is far from the world origin.
The range determines the minimum and maximum values that can be stored in the number. If the player tries to move past this range, they will simply not be able to. However, in practice, floating-point precision almost always becomes a problem before the range does.
The range and precision (minimum step between two exponent intervals) are determined by the floating-point number type. The theoretical range allows extremely high values to be stored in single-precision floats, but with very low precision. In practice, a floating-point type that cannot represent all integer values is not very useful. At extreme values, precision becomes so low that the number cannot even distinguish two separate integer values from each other.
This is the range where individual integer values can be represented in a floating-point number:
Single-precision float range (represent all integers): Between -16,777,216 and 16,777,216
Double-precision float range (represent all integers): Between -9 quadrillon and 9 quadrillon
Range |
Single step |
Double step |
Comment |
[1; 2] |
~0.0000001 |
~1e-15 |
Precision becomes greater near 0.0 (this table is abbreviated). |
[2; 4] |
~0.0000002 |
~1e-15 |
|
[4; 8] |
~0.0000005 |
~1e-15 |
|
[8; 16] |
~0.000001 |
~1e-14 |
|
[16; 32] |
~0.000002 |
~1e-14 |
|
[32; 64] |
~0.000004 |
~1e-14 |
|
[64; 128] |
~0.000008 |
~1e-13 |
|
[128; 256] |
~0.000015 |
~1e-13 |
|
[256; 512] |
~0.00003 |
~1e-13 |
|
[512; 1024] |
~0.00006 |
~1e-12 |
|
[1024; 2048] |
~0.0001 |
~1e-12 |
|
[2048; 4096] |
~0.0002 |
~1e-12 |
Maximum recommended single-precision range for a first-person 3D game without rendering artifacts or physics glitches. |
[4096; 8192] |
~0.0005 |
~1e-12 |
Maximum recommended single-precision range for a third-person 3D game without rendering artifacts or physics glitches. |
[8192; 16384] |
~0.001 |
~1e-12 |
|
[16384; 32768] |
~0.0019 |
~1e-11 |
Maximum recommended single-precision range for a top-down 3D game without rendering artifacts or physics glitches. |
[32768; 65536] |
~0.0039 |
~1e-11 |
Maximum recommended single-precision range for any 3D game. Double precision (large world coordinates) is usually required past this point. |
[65536; 131072] |
~0.0078 |
~1e-11 |
|
[131072; 262144] |
~0.0156 |
~1e-10 |
|
> 262144 |
> ~0.0313 |
~1e-10 (0.0000000001) |
Double-precision remains far more precise than single-precision past this value. |
When using single-precision floats, it is possible to go past the suggested ranges, but more visible artifacting will occur and physics glitches will be more common (such as the player not walking straight in certain directions).
See also
See the Demystifying Floating Point Precision article for more information.
How large world coordinates work¶
Large world coordinates (also known as double-precision physics) increase the precision level of all floating-point computations within the engine.