Hey Robert,

Thanks for the detailed response. I had a few follow up questions.

On Tue, Feb 14, 2012 at 7:39 AM, Robert Osfield
<robert.osfi...@gmail.com> wrote:
> Hi Preet,
>
> Rui was a little cryptic is his explanation so I'll expand on it
> further.  What you are seeing is numerical precisions issues down on
> the graphics card as internally the graphics card uses floats for
> vertices and floats for the modelview matrix.
>
> The solution to this problem is make sure all geometry data has a
> local origin and use a transform node (such as an
> osg::MatrixTransform) that decorates your geometry and places it in
> world coordinates.

I didn't understand what was meant by local origin here. Let's say I
have a model of the Sphinx I want to show on the surface of the Earth
(coincidentally I'm trying to display geospatial data).

Are you suggesting that I draw the model with coordinates relative to
the origin of of the scene first ('local'), then parent the
corresponding geode with a matrix transform that scales/moves/rotates
it out to the correct position on the Earth's surface ('world
coordinates')?

I found a few references online to a somewhat similar solution that
suggested transforming the entire scene so it's centered at the origin
before passing it to OpenGL. Is this a worse or better approach than
the suggested fix?

> The OSG by default uses double's for the Camera's
> View matrix and double's for the transform nodes and when accumulating
> all the matrices during the cull traversal uses doubles as well so
> that by the time the OSG maintains precision all the way till it
> passes the modelview matrix to OpenGL.  Typically when you are close
> to your geometry the translation component of Camera's View matrix
> will cancel out with the translation component of your scene graph
> transform node, so that you end up with a final modelview passed to
> OpenGL with modest translation component that doesn't present any
> numerical precision issues, solving the precision.
>
I understand that numerical precision decreases when rendering a scene
further from the origin, because there are a finite set of numbers you
can represent in floating point. Using doubles for the transform and
carrying doubles throughout the scene graph traversals increases
precision right up until the data is passed to OpenGL. I didn't quite
follow your explanation about the camera and geometry translations
cancelling out though... could you expand on this a bit?
>
> This approach is commonly used when tackling whole earth geospatial
> data, and you'll see it in action in the paged databases that
> VirtualPlanetBuilder creates, 3rd party NodeKit's like osgEarth use
> this approach as well.

I'll take a look at the source for both of these projects, thanks :)
>
> Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to