Menu

#9 Trajectory lines jitter when zoomed in

1.0
closed
None
2018-10-07
2016-08-04
Ravi Mathur
No

When zoomed into a model that's following a trajectory, the trajectory line will jitter. As the trajectory gets further from the origin, the jitter gets worse.

Discussion

  • Ravi Mathur

    Ravi Mathur - 2016-08-04
    • status: open --> accepted
     
  • Ravi Mathur

    Ravi Mathur - 2016-08-14

    This happens because the vast majority of OpenGL implementations and graphics cards store and process vertices as 32-bit floats. OpenGL computes the plotted location of viewed vertices by subtracting their absolute coordinates from the current eye point coordinates. When these are very close, e.g. when zoomed into a trajectory, 32-bit subtraction yields large errors that manifest as jittering. This is best seen when viewing a spacecraft model that is very small and/or at very large distances, since the spacecraft will always be right on top of a trajectory.

    The fix is to use Rendering Relative to the Eye on the GPU [1-3]. All vertices are split from double precision to two floating-point numbers (high & low parts) using the method of Knuth. The high part is submitted as a standard glVertex, and the low part as a vertex attribute. Additionally, the current eye point is extracted from the ModelView matrix and submitted as an OpenGL shader Uniform. The shader then reassembles them in the GPU using double-single arithmetic.

    This method works both when far from the trajectory (eye point far from trajectory vertex) and close to the trajectory (eye point close to trajectory vertex). It has been implemented in OpenFrames, and a new example called "test_jitter" has been added.

    Note that this does NOT fix jitter associated with vertices that are very far apart. In the test_jitter example, vertices are separated by 1 billion km, while the spacecraft itself is only 1cm large. When the spacecraft is between vertices, there is jitter associated with vertices being very far apart. This will likely not occur in real simulations, since the numerical integrator won't take such huge steps. However, the full solution might require the use of a Geometry Shader to insert an intermediate vertex near the current eye point. Unfortunately Geometry Shaders are only available in OpenGL 3.2+, which is not supported by OSX XQuartz which is used by the Winteracter GUI framework.

    1. A. Thall, "Extended-Precision Floating-Point Numbers for
      GPU Computation", Alma College Tech Report
      , March 2007.
    2. P. Cozzi and K. Ring, "3D Engine Design for Virtual Globes," Chapter 5, Google Books., 2011.
    3. Deron, "Precisions, Precisions" AGI Blogs, Sep 2008.
     
  • Ravi Mathur

    Ravi Mathur - 2016-08-14
    • status: accepted --> pending
     
  • Ravi Mathur

    Ravi Mathur - 2018-10-07
    • status: pending --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.