Page 1 of 5 12345 LastLast
Results 1 to 10 of 43

Thread: Jumping lines during rotation

  1. #1
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Jumping lines during rotation

    Hi again Guys,


    Here is today's issue, I am sure you know the reason.

    First scenario:

    2D drawing of lines only the, bounding rect (0,0, 400, 800) I can zoom / rotate without problems.

    Second scenario:

    Same 2D drawing of lines only, far from origin: bounding rect (490000, 500000, 400, 800). When I zoom / rotate I see the line ends jumping 2-3 pixel right/left/top/bottom at every frame.

    Why?!? How can I improve this?


    Thanks so much in advance.

    Alberto

  2. #2
    Junior Member Newbie fldz's Avatar
    Join Date
    Mar 2007
    Posts
    11

    Re: Jumping lines during rotation

    It's a matter of precision.
    If it were me, (a 100% guessing noob) and I really needed a half million units to be represented, I'd have like a Level Of Detail switch, but for scale.
    Say it's a solar system, have a scaled down version whenever you reference that big a number, so the solar system model gets tiny but the bounding universe stays around 0,0,400,800

    ie: scale down the solar system model instead of scaling up the universe?

  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Jumping lines during rotation

    500000 Does not seem big enough to bring serious precision problems.
    Can you post your code ?

  4. #4

    Re: Jumping lines during rotation

    Just for your info. I experienced this, with my 42Hz Interlaced CRT monitor during animation.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Jumping lines during rotation

    ZbuffeR,

    I don't know what to copy & paste, the relevant code is here and there. Please tell me what it is intersting to you, for example gluPerspective settings, near and far planes or what?

    fldz,

    Customers don't want scaled models, we were forced to switch to real scale coords.


    Thanks,

    Alberto

  6. #6

    Re: Jumping lines during rotation

    Whats the biggest and smallest number in the model coordinate? As far as I know, there are no scaled/real scale stuff in CG. I think it will be automatically adjusted. But, it will affect the object data size (higher precision, higher data - eg: a huge tower, and an ant), the coordinate precision will still be adjusted automatically.

    I think codes within the OpenGL loop will help.

    zbuffer, please correct me if I am wrong.

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Jumping lines during rotation

    Yes, my answer was a bit rushed, should have mentioned that it is not the absolute values that matters, but the relations between numbers. Unless you have flower to mountain ratios, it should be ok.
    Interesting code will be the projection and modelview matrix manipulations, glviewport, how is translated and scaled geometry according to user input (or scripted sequences if done in a non-interactive way).

  8. #8
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    Re: Jumping lines during rotation

    Hi, I believe I'm having the exact same problem in my scene...I'm using JOGL so the code is slightly different but the concepts are all the same.

    Let me setup what I have...basically I have an Earth based system with a vehicle orbiting the Earth. I have made both the vehicles and the Earth the correct relative scale which means the vehicle itself is tiny and requires a very small near clipping plane so that I could zoom in to it. That said, I don't believe the clipping plane distance is the root of this problem as I'll explain later.

    My problem is that when I zoom in close to the vehicle, around which I've drawn various lines and some shapes, I notice that I get very bad jitter (objects and shapes move relative to each other, etc) when I rotate my view - I'm not rotating or changing any coordinates, simply rotating my view around it...yes, effectively I am rotating the objects because I apply the glRotated() rotations but I think you know what I mean. To clarify, I'm rotating about the vehicle which is not at the center of the OPENGL scene, because the Earth is at the center - the vehicle is offset about 6000 kilometers/units away and I employ a centering technique so that I move to the vehicle and rotate around it as if it was in the center. The jitter happens when I do rotate about the vehicle but if I move the vehicle closer to the center of the opengl world - ie to 0,0,0 (inside the Earth) then the rotations are perfectly smooth and I don't see jitter.

    What I do is basically the following (JOGL code snip):
    I chose the body to focus on and translate that body to
    the origin I then apply these rotations based on mouse
    inputs:
    gl.glRotated(rotX, 1.0, 0.0, 0.0);
    gl.glRotated(rotZ, 0.0, 0.0, 1.0);
    Then I translate the body back to its position

    I did notice one thing...when I only rotate about one axis and keep the other axis at 0 degrees then I don't see jitter....but as soon as the other rotation is non-zero (ie rotZ is 1.0 degree for example) and I move my mouse to rotate rotX then I see jitter...and again, only if the object is not at the center. SO, it makes me think that there is more than just order of rotations that could be at fault, it seems like the distance of the object and the need to perform multiple translates is causing issues too.

    Also, I do have a very near clipping plane because the object I have is a vehicle who I want to be able to zoom close too and yet I want to see the Earth background below it and so the far clipping plane is far as well and I wonder if the combination of these two and the other factors are combining for the jitter. Just as a test I reduced the far clipping plane significantly to see if maybe the ratio of the distances of far clipping plane to close clipping plane is a factor and it is not...the jitter still exists even though I have a low ratio.

  9. #9
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Jumping lines during rotation

    ZbuffeR,

    Here are some values from our program. Do you see something wrong?

    Code :
    glViewport(0, 0, 344, 383);
     
    gluPerspective(26.99, 0.89, 0.05, 287.96);
     
    gluLookAt(
    {491663, 475896, 14.4254},
    {491658, 475907, -0.350002},
    {-0.623493, 0.50244, 0.599008});

    Z-Knight,

    Yes we are doing the same thing: rotating around a center very far from the scene origin. Why don't you post the data I've just posted so we can compare them?


    Thanks,

    Alberto

  10. #10
    Member Contributor
    Join Date
    Jul 2008
    Posts
    99

    Re: Jumping lines during rotation

    I'm trying to put together a little JOGL online demo for you to load and see my exact problem and I hope to have that working sometime today...my demo consists of a 3D earth scaled to the correct size in kilometers and a teapot representing the International Space Station (or some other vehicle) that is scaled to the correct size (so it means it is quite tiny in comparison - 50 meter radius (0.050 km) and I notice that my horrible jitter happens when the vehicle is away from the center of the scene and I've minimized the number push/pops and translations/rotations/etc so as to eliminate any possible cummulative errors in calculations - though there still could be some.

    Anyway, here is what I have for my settings:

    Code :
    glViewport(0, 0, 640, 480);
     
    // I can vary the far plane distance from 100 to 100000000.0
    // and I get the same jitter
    gluPerspective(65.0, 1.333, 0.005, 100000000.0);
     
    gluLookAt(
    {10000.029588568046, 10000.004951428176, 10000.014084146884},
    {10000.0, 10000.0, 10000.0},
    {0, 1, 0));

    The reason my gluLookAt eye point is so close to the lookat point is because I have a very small object so I want to be close to it to view it.

    I have to believe that being so close is the cause of my problem but it also confuses me that I can be this close at 0,0,0 and not see the same jitter...for example my gluLookAt is this:

    Code :
    gluLookAt(
    {0.029588568046, 0.004951428176, 0.014084146884},
    {0.0, 0.0, 0.0},
    {0, 1, 0));

Page 1 of 5 12345 LastLast

Similar Threads

  1. Jumping/stuttering (probably lag)
    By Brad811 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-12-2012, 12:40 PM
  2. Rotation of lines wrt x-axis
    By umeshvl in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-03-2009, 11:15 PM
  3. Jumping?
    By LangdonAlgers in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-20-2006, 12:16 PM
  4. Need help showing parallel lines during rotation
    By johnquinn888 in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 10-21-2004, 08:40 AM
  5. Lines jumping around
    By Super-K in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 02-09-2002, 06:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean