Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Far away from 0,0,0

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    6

    Far away from 0,0,0

    Hi,

    I've heard that OpenGL's calculation is unprecise when it comes to geometry that is placed far away from 0,0,0.

    My question is, in what radius from 0,0,0 is it "safe" to deal with geometry.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: Far away from 0,0,0

    There is really no general answer to that, it heavily depends on your geomentry.

    I don't know for sure what format most hardware manufacturers use for internal geometry representation but for demonstration purposes lets assume it is 32 bit IEEE float.

    This format uses a 23 bit mantissa, so you have a precision of 1/2^23, that is 1/8388608. So when you are 8388608.0 units away from the origin, the smallest distance that can be represented is 1.0, when you are only 83.88608 away, the smallest distance that can be represented is 0.00001.

    In practical application this isn't a problem, because when your objects are very large they usually have no very small details, because they would not be visible anyway.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    6

    Re: Far away from 0,0,0

    Thanks for the reply.

    What about if you have a geometry(10 units hight, width and deep), modelled in origo, and translate it 8388608.0 units away?

    Would it be the same problem?

    /Joakim

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: Far away from 0,0,0

    In theory, yes, you would get precision problems if you do that.

    But if you have a cube of 10 units size that is 8388608.0 units away from the camera (after modelview transformation the camera is in the origin), it would be a lot smaller than a pixel, so you can't see the precision problems...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •