precision problems

Hello all,

I need to display objects with very big coordinates in my application.
When I try to display these objects, some visualization problems appear. When I move the camera, the geometry coordinates seems to change at each frame like each point is moving randomly.
It seems like precision problems.
I use only double precision values so it is a bit strange.
I use a lot of matrix transformations so maybe the problem comes from matrix operations. Matrix values are also defined with double precision.
Has someone already had this problem?

Thanks a lot for your answers.

Emmanuel Quételard
Igeoss.

Double precision is not supported by hardware, so it all gets converted to floats anyway… I don’t have a solution for you though, only some value ideas. I would recalculate the positions relative to the camera on-the-fly so that they fit the single precision when drawing.

If you are using matrix inversion, try taking tha nature of the matrices into account.

e.g. the inverse of modelviewmatrix without skewing/scaling:



Modelview = | R3x3 t3x1 |
            |   0    1  |

Inverse   = | R3X3_transpose -R3X3_transpose*t3x1 |
            |        0               1            |

You can make small adjustments for it to support scaling.

You can also write closed form inverse math formulas for the inverse of projection matrices (ortho/perspective). They will most likely be more accurate than the generic operations used to invert an arbitrary 4x4 matrix because projection matrices are sparse.