Near Clip Plane and Radeon Z-Buffer Problems.

Discussion in 'Architecture and Products' started by Jamm0r, May 10, 2003.

  1. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    Howdy,

    We're having Z-Buffer issues with Radeons on a PC Simulation project I'm working on. Here's an example:

    [​IMG]

    Only Radeon r200 and r300 vide cards suffer from this rendering error. Basically, when in the cockpit, where we set a near clip distance of 8, some objects such as tree lines and portions of the landscape seem to loose their Z values, and show through the scenery, as can be seen above. In external view, where the near clip plane is set to 200, the problem disappears. Nvidia and other video card users do not have these rendering errors.

    Any ideas?
     
  2. sireric

    Regular

    Joined:
    Jul 26, 2002
    Messages:
    348
    Likes Received:
    22
    Location:
    Santa Clara, CA
    What's your far plane set at? If your far/near ratio is too large, you'll exceeed the precision of the Z buffer.

    Different cards have different rendering techniques. Are you using 16b or 24b Z?
     
  3. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    sireric: 16 or 24 doesn't seem to make a difference. Far clip plane is set to the minimum possible value implemented by the original developers (I'll dig it up in a few minutes, and it's not a huge value IMHO.) Here's another shot that better illustrates the problem:

    [​IMG]

    I set the near clip value to 8 for this external shot. Normally, it would be 200 as I stated above.
     
  4. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    The minimum far clip value ("Near" horizon distance), without some tweaks we recently added, is 1114112. However, we recently added a multiplier, selectable through the GUI, that decreases this significantly if needed. In the rainy condition seen above, which I coded, the clip value is 1114112 * 0.3
     
  5. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    [​IMG]

    I think that says it all. As you can see, the far plane is set to 314572. I'm using the line:

    g_lpLib3d->SetNearClipPlane( NON_COCKPIT_NEARZ );

    to experiment with different near clip values. When I set the near plane to NON_COCKPIT_NEARZ ( 200 ), I get no rendering issues. When I set it to COCKPIT_NEARZ ( 8 ), I do.
     
  6. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    Is there a problem with Catalysts and applications using the D3D7 EnumZBufferFormats? I'm noticing that the returned ZBufferBitDepth and StencilBitDepth values are not what they should be...
     
  7. KimB

    Legend

    Joined:
    May 28, 2002
    Messages:
    12,928
    Likes Received:
    230
    Location:
    Seattle, WA
    Well, that ratio shouldn't be that excessive.

    Unreal Tournament uses 0.5 for the near clip plane, and 32,768 for the far plane. That's about twice as high a ratio. While there are z-buffer errors in UT, they are typically not anywhere close to that severe. I usually only notice them with decals.
     
  8. Kristof

    Regular Alpha

    Joined:
    Jan 30, 2002
    Messages:
    733
    Likes Received:
    1
    Location:
    Abbots Langley
    Try using a tweak tool to disable HyperZ and other options. On FableMark we found that to get it to render correctly on R200 we had to disable HyperZ (caused a weird Z issue with stencil shadow effect) and even hardware vertex processing (different lighting paths were causing slightly different vertex results and created Z-Fighting) for some driver revisions. I am not sure if these issues got fixed in later driver releases.

    K-
     
  9. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    Thanks for the replies. Kristof: is it even possible to disable Hyper-Z and other options on the r300? I know it's possible on an r200, but I was under the impression that these tweaks didn't work on an r300.
     
  10. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    Ok. I fixed the problem. Early on in rendering, a check is made if the viewpoint is in the cockpit or not, and sets the near plane to 8 or 200, as discussed above. This is wrong, because it is being set to 8 BEFORE rendering the landscape (and clearing z.) Since it already sets the near plane to 8 right before rendering the cockpit, I changed it from 8 to 200 (before rendering the lanscape.)

    Ahh well, this was definitely an interesting, if not frustrating, experience. Thanks again for all the help. I would have preferred if ATI had a more precise Z-buffer in the first place, even if it costs a little in the speed dep't.
     
  11. Kristof

    Regular Alpha

    Joined:
    Jan 30, 2002
    Messages:
    733
    Likes Received:
    1
    Location:
    Abbots Langley
    Not sure, our problem never appeared on R300 only R200 so I never really tried.

    K-
     
  12. OpenGL guy

    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,357
    Likes Received:
    28
    This sounds weird. It sounds like you are changing the near plane without clearing the Z buffer, this is a very bad idea. The Z buffer values depend on the near and far planes so if you change them, you must clear the Z buffer. Sorry if I am misunderstanding you.
    I can't speak for the R200, but the R300 has about the same Z accuracy as the GeForce 4. I've verified this myself. However, the GeForce 4 (and R200) has W buffering which the R300 does not support so this can cause some differences in results.
     
  13. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    We do indeed clear Z when modifying clipping planes. And yes, you are correct, the game uses a W-buffer if available.
     
  14. OpenGL guy

    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,357
    Likes Received:
    28
    Then that explains why you didn't see any problems on the GeForce ;)
     
  15. Jamm0r

    Newcomer

    Joined:
    Dec 31, 2002
    Messages:
    56
    Likes Received:
    0
    Rgr that. ;)
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...