Results 1 to 6 of 6

Thread: when the scene doesn't fit the frustum

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    7

    when the scene doesn't fit the frustum

    I'm trying to render the earth using a quadtree (independent sections) in a planar projection (I can't make use of the earth curvature). That means my desired frustum is from 1 to about 24000000 to be able to see the entire earth plane sitting in one corner very near the ground to the other corner of the earth plane. Obviously I'm having z-fighting issues (as well as jitter due to float precision, but that is another matter).

    I tried the method explained in the page 45 of this pdf :
    1. Set zFar to the maximum value needed.
    2. Set zNear = zFar / ratio.
    3. Clear z-bu er.
    4. Render scene and cull to the adjusted frustum.
    5. Set zFar = zNear.
    6. If zNear isn't close enough yet go back to step 2.

    But I'm getting problems in the zone where the two frustums touch, it looks like this and I can't figure out what's going wrong. I render the image in two passes, one with a different frustum from 50 to 50000000 and from 1 to 50, as mentioned in the pdf, clearing the zbuffer in between.

    Do you have any idea of what I'm doing wrong?

    I'd also appreciate suggestions on alternative aproaches.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649

    Re: when the scene doesn't fit the frustum

    Let's first verify that that "step" you're seeing isn't being drawn. Clear your color buffer after each frame.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    7

    Re: when the scene doesn't fit the frustum

    I do.

    I clear zbuffer+color buffer,
    draw the entire scene with the first frustum,
    clear the zbuffer,
    draw the same entire scene with the second frustum,
    and start again.

    I make sure the scene is the same (no camera movements) every entire frame.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649

    Re: when the scene doesn't fit the frustum

    Ok, scratch that. You are clearing the color buffer. That vertical "step" is really odd. Are you sure it's not in your data? That is, it moves along with your eyepoint as it moves into the scene?

  5. #5
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,214

    Re: when the scene doesn't fit the frustum

    I think that you have got exactly what is expected. Think for a while and you'll realize that. You have two different spaces converted to fragments. Z-buffer settings are not the same for both, so cracks or "jumping" vertices is a normal phenomenon. Presented technique is very applicable, but for the space, where planets do not touch. Rendering a terrain is a little bit different.

    I'll read the paper and take a look at what they have done, but my advice is to create a stitch area, or extend both areas/blocks so that they overlap.

    The drape on the edge is probably the result of the way blocks are drawn.

  6. #6
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    7

    Re: when the scene doesn't fit the frustum

    Overlapping the near/far planes by a little doesn't work (1-51 and 50-50000000), overlapping them by a lot, curiously enough, seems to work (1-10000 and 50-50000000).

Similar Threads

  1. Spotlight doesn't light up my scene
    By profoX in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-31-2011, 06:35 AM
  2. cut frustum
    By arthas in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-08-2008, 05:31 PM
  3. frustum
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-04-2005, 01:00 AM
  4. ReadPixels doesn't work with Textured Scene?
    By rangers99 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-07-2002, 10:06 PM
  5. how to display 2d scene on top of 3d scene???
    By immy in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 03-26-2002, 04:13 AM

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