I spent some time over the weekend struggling with the jitterbug
(sorry, couldn't resist).  I haven't fixed it, but I have pinpointed
the issue.

In essence: yes, it's a precision problem; but no, Jim's calculations
aren't the problem.  The problem is actually the organization of the
scene graph.  Right now, it looks basically like this:

Camera (move to terrain origin, orient to terrain/global frame)
 |
 +-- Terrain
 |
 +-- Transform (bring origin back to near viewpoint, orient to model frame)
      |
      +-- Aircraft Model

That is, the top-level camera matrix includes a 1000m or so
translation to the local tile centroid.  This translation thus has to
be "undone" by the aircraft model matrix in order to move the origin
back to the region near the viewpoint.  But this is exactly the
problem -- in 32 bit float precision, two 1000m translations are only
accurate to a few millimeters.  Not good enough.  Even if the number
that generated the matrices were perfect, we'd still be seeing the
jitter.

And the simplest solution -- use doubles -- isn't even an option here
because the math is happening inside OpenGL.  Consumer graphics cards
don't even *have* double precision GPUs.

What I'd suggest, which still takes some surgery, is to reorganize the
scene graph to remove the double-translation.  Something like this,
which pushes the tile centroid translation down into the terrain
branch, should work well:

Camera (orientation only, no position change)
 |
 +-- Transform (move to terrain origin)
 |    |
 |    +-- Terrain
 |
 +-- Transform (move to model origin, orient to model frame)
      |
      +-- Aircraft Model

I got started trying to figure out how to do this, but got a little
lost.  Jim, you know this code a lot better than I do, how hard would
that be to do?

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
 - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to