Re: [Algorithms] Huge world, little precision
Brought to you by:
vexxed72
|
From: Jon W. <hp...@mi...> - 2007-02-28 19:22:47
|
George van Venrooij wrote:
> 3) All goes perfectly well, until the viewer gets really close to the
> surface of the planet and the terrain triangulation produces detail at
> roughly meter resolution. When this happens, vertices near the viewer (or
> the viewer itself...) appear to be "jumping" when moving small steps (in the
> order of a meter per frame).
>
Yup. That's just an artifact of the quantization in the floating point
representation. We've done on-the-ground foot-scale earth-size terrain
since 2001, and we use doubles for the "general" coordinates. However,
geometry is generated in a localized coordinate system as floating point
(because hardware can do nothing else), and the difference relative to
camera is made up in the transform matrix. This turns out to compensate
nicely for jitter, and we can zoom from space to your face.
Thus, the trick is:
- generate geometry in a local (float) coordinate space per geometry
"thing" (ground block, cultural, what have you)
- keep camera and "thing" coordinates in double precision
- Subtract double precision quantities to yield a single-precision
transform matrix
Cheers,
/ h+
|