No cookie for

Earth — Big and Round

Earth — Big and Round

When we create a virtual world for modeling, simulation & training, does it matter if we use a “round-earth” coordinate system and 64-bit precision in our coordinates? Yes, but much more so in some circumstances than others. 

Let’s start with the basic concepts. We all know that the world is round, well round-ish, but most of the time we can’t see the effect. When you stand on a rise and look into the distance it’s the shape of the topology that dominates your view. You can’t really see the curvature of the earth. 

So, if you make a 3D terrain database of that area, why do you need to care about the roundness of the Earth or the number of bits in your coordinates? There are really two concerns: the shape of the terrain and how entities are simulated in the space on and above the terrain. Let’s start with the terrain.

If you do the right math, you can build your simulation terrain by projecting the locations of the vertices that define the terrain surface and the locations of all things into a “flat” system based on a map projection, where the XY plane defines the horizontal and the Z-axis represents altitude. Simulators that operate in flat-earth systems can take advantage of simplified calculations by treating the XY plane as horizontal and the Z-axis as the direction of gravity. These flat systems can be accurate enough for small distances. But as the distance grows larger, the distortions that are inherent in all map projections become apparent. Depending on which projection you use, straight lines in the real world become curves or have the wrong bearing. Map projections either distort or tear if they cover the whole Earth. Try peeling an orange and laying the skin flat on a table.

Another approach is to maintain a round-earth model but to transform a patch of it so that the simulation can continue to operate with simplified calculations in the local cartesian system. Again, this will be acceptable in sufficiently small areas, but the Earth falls away from the horizontal plane over long distances, making ballistic calculations in the local system inaccurate. If an airplane flew straight and level, it would eventually fly off the Earth into orbit. Long-range precision fires would not hit the correct locations.

To truly operate in a model of the whole Earth where simulation is happening at any collection of arbitrary places, the Earth must, of course, be “round” and the coordinate system used must have sufficient resolution to maintain precision across the whole globe. This is where the 32bit vs. 64-bit distinction comes into play.

When representing numbers in 32-bit floating-point variables, values between 2n and 2n+1 have a precision of 2n-23, so for example, for values between roughly 250km and 500km, the precision of 32-bit floats is about 3cm. This means that you can represent positions on a single axis up to 500km away from a local origin to an accuracy of 3cm. That’s not that bad. However, given that a 3D location requires 3 coordinates, the inaccuracy compounds: For a 3D location, 32 bits gives you an “error” of up to about 6cm. That’s definitely enough to notice feet stuck in the ground, or 6cm of “jitter” as a soldier attempts to move in a straight line or to miss a target. But even that’s really *best* case - if you do all of your math in 64-bit, and just convert to 32-bit at the very end. If you do all of your calculation and representation of interim values in 32 bits, then you lose precision with each math operation - meaning that in reality, you’ll end up with errors of 10s of centimeters when you’re 250-500km from the origin - way too much to be usable. It’s why 32-bit game engines are generally limited to play boxes that are much smaller than 250km.

The point is that a) That it’s possible to model a curved-earth surface (for small sections of the earth) without requiring 64-bit math, and b) That going to 64 bits alone doesn’t automatically make you a round-earth simulation. Going from flat-earth to round-earth is a much more fundamental change to an application than going from 32-bit to 64-bit.

MAK products have been truly natively simulating in round-earth and using 64-bit precision (a.k.a., “double precision) for all of our calculations for about 20 years. Our customers have always been able to do things like having a plane take off and fly continuously around the world without shifting or offsetting coordinate systems - while simultaneously having human characters walking around accurately on the ground on the other side of the Earth from the plane. We do this both on the VR-Forces Simulation Engine side and the VR-Vantage Image Generator side.

P.s. The Earth is not literally “round”. Round is shorthand for an Earth that is modeled with respect to the geoid and referenced to the WGS-84 ellipsoid. 
P.p.s. Don’t confuse 64-bit operating systems with 64-bit floating-point math

Changing the world by making virtual events better
Partner Spotlight: Varjo

Related Posts

By accepting you will be accessing a service provided by a third-party external to