Large world coordinates - double precision data

1000,001 1000 meters and one millimeter in meters
100000,1 1000 meters and one millimeter with same number of digits in centimeters.

Still way too small for KSP :stuck_out_tongue:

UE5 uses a tiling system, I donā€™t know exactly how itā€™s implemented, but on the GPU side UE5 still works with single precision.

FF15 uses luminous engine.
FF16 started with unreal, then they moved to a modified version of FF14 engine.

1 Like

If Minecraft can do it Unity should be able to do it too. Iā€™m using ArcGIS in Unity that shows the whole world in scale. The precision jitter is definitely a problem. Luckily ArcGIS does provide a Rebasing component that updates the origin to the Camera every now and then to avoid the issue (like floating origin).

maybe youā€™re interested in this:
https://web.mit.edu/tabbott/Public/quaddouble-debian/qd-2.3.4-old/docs/qd.pdf
Iā€™v impled double-double on Burst in Unity, for full visible universe size(46 billion light year diameter) of continuous high precision coordinate, and thereā€™s no obvious performace impact on desktop CPUs. This algorighm works for single precision either(for GPU), but in my opinion, thatā€™s not necessory, because we can upload camera-relative position of meshes to GPU just for rendering-single precision position is really enough.

3 Likes

You used a similar approach to the linked library then? Do you mean thereā€™s no performance impact vs double, or vs single precision?

1 Like

Just a friendly reminder that Unreal has supported double precision transforms (enabled by default) since April 2022. It was introduced with Unreal 5.0.

Unity, how are your plans coming along to remain technically competitive?

Steadily and methodically :slight_smile:

3 Likes

Does this refer to the ā€˜point of return on investmentā€™? It seems that less than 0.01% of PC games, in contrast to Android offerings, might only reach this point by the third decade, if at all.

Oh, and the gap in awaiting the ā€˜point of return on investmentā€™ is likely to increasingly widen the divide with other 3D engines. :slight_smile:

Edit:
And for those who donā€™t quite grasp the concept of extended distances, the command buffers and shaders also have to go through the whole litany of 64-bit calculations. It wouldnā€™t be pleasant to see if the textures on the objects and the vertices themselves start to swim.

2 Likes

Unrealā€™s large world coordinate support is fantastic. It just works. How are the steady and methodical plans coming along on the Unity side? Any progress to share?

Thanks,
Shaun

2 Likes

There are ways to pack doubles as 2 floats so to calculate more precisely height(on gpu so creating procedural worlds) where distances are far away from camera keeping camera all the time at origin position(hdrp does this already(move camera to origin), also it uses a kind of logarithmic function for depth buffer which is also helpful for creating Earth size planets) - but it will require more memory on gpu side also the code will be slower.

Thanks, bb8. To remain relevant as an engine product, it is time for Unity to support double-precision coordinates in transforms and rendering pipelines.

3 Likes

It does seem a little crazy. Is there any doc on the design motivations behind this?

1 Like

There is more crazy stuff going on in mono than sane stuff :smile:
Meanwhile .NET 8 is faster than ever. Jitted code is often on par with native code.

2 Likes

Jitted code is actually always native (machine) code, but the quality is far better than mono. A large part of the performance in modern .NET also comes from optimizations in the .NET library.

2 Likes

I ment handwritten native code. .NET 8 outperformance alot of handwritten native code

1 Like

ok, thanks for clarifying.

To be fair, I can think of one case where there would be some benefit: if you are going to multiply two or more large numbers and then reduce them, such as in the square root of sum of squares distance formula, then converting to double beforehand will reduce the additional error from the squared floats ā€œoverflowingā€ the 32bit limits. Then, after the double square root put the result back into float.

I would still like to see Unitiyā€™s design reasoning - if it is documented, implementation details and some measurements.

My alternate preference is to minimise the size of the numbers, for the most important calculations (around the observer/player), by keeping the observer at the origin (no periodic shifting) and doing everything in floats. No need to incur the casting costs of upcast-calculate-downcast and the extra memory allocation costs for the doubles.

HDRP does exactly that (camera relative-rendering), but positions in the scene are stored as floats and physics is also calculated in floats in worldspace.
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.0/manual/Camera-Relative-Rendering.html

Well mono does it for two floats so if you for example multiply two floats it will cast both to doubles multiply them and cast the result back to float. Zero gained.