From: Yair Kurzion (yair++at++polygon.engr.sgi.com)
Date: 01/03/2000 14:29:53
Hi John !
> I have an application I am working on, using
> ECEF WGS-84 coordinates. For accuracy, this app
> would/should require 64-bit floating point numbers.
> Is there any way, or any version of performer that
> supports this?
First, although OpenGL supports double precision parameters, I believe that all
current implementations of OpenGL convert to single precision. So, data bases
with very large vertex coordinates will suffer from precision problems.
Performer attacks this problem by making the following observation: If some
portion of your database is visible, it must be fairly close to your camera
position. So, even though both your camera and the database are very far from
the world origin, you can define a local origin and use it for drawing any
database part with single precision math.
As an example, if your database origin is in the center of the earth, and you
fly close to Mars, you can use a local origin on the surface of Mars for
drawing pieces of the Mars surface.
In order to implement this local origin, Performer provides the classes:
pfDoubleDCS, pfDoubleSCS and pfDoubleFCS. They are similar to pfDCS, pfSCS and
pfFCS but take a double precision matrix.
So, here are the ingredients:
o Assume you have a database tile T with origin at (Tx, Ty, Tz). This origin is
some arbitrary point on the tile. Assume your camera is in (Cx, Cy, Cz).
o Always set the Channel camera position (pfChanView) to (0, 0, 0).
o Build your scene graph with a pfDoubleDCS node on its top. This top node
should contain a translation (-Cx, -Cy, -Cz). You should change this
DoubleDCS matrix every frame as your camera moves.
o The vertices of T should be created assuming that (Tx, Ty, Tz) is the origin.
If the tile is small enough, all its vertices should be small enough to
use single precision math.
o Put a pfDoubleDCS node on top of your tile subgraph. This node should contain
a translation to (Tx, Ty, Tz).
These operations end up folding the pfChannel viewing matrix into the scene
graph. When Performer traverses the scene graph in the CULL stage, it computes
the matrix transforming every node. Performer computes this matrix on the host
CPU using double precision math. In the case of your tile T, the matrix
transforming the tile contains the translation (Tx - Cx, Ty - Cy, Tz - Cz). By
the original observation, your camera is be close enough to the tile T that this
translation can be expressed with single precision math.
The sample code in:
/usr/share/Performer/src/sample/C/clipfly/
uses this method.
-yair
--
\_________ \_____ \__ \__ \_____ Yair Kurzion
\_________ \_____ \__ \__ \_____ yair++at++sgi.com
\__ \__ \____\__ \__ http://reality.sgi.com/yair
\__ \__ \__ Work: (650) 933-6502
\__ \__ \__ Home: (408) 226-9771
\__ \__ \__
This archive was generated by hypermail 2b29 : Mon Jan 03 2000 - 14:29:54 PST