Results 1 to 3 of 3

Thread: Near plane

  1. #1

    Near plane

    Hi all!

    In D3DXMatrixPerspectiveFovLH why did i have to set then near plane to 0.1 and not to 0.0 otherwise the render is not correct? (z-buffer artifact)

    Could someone explain this? :roll:

  2. #2

    Near plane

    Because you'll get W precision lost (division by ZERO)!!!
    Minimum recommended near clip plane settings == 1.0
    Your value of 0.1 will probably lead to Z artifacts at way to FAR Z-plane too.

    Matrix used for D3DXMatrixPerspectiveFovLH:
    Code:
    w       0       0               0
    0       h       0               0
    0       0       zf/(zf-zn)      1
    0       0       -zn*zf/(zf-zn)  0
    where:
    h is the view space height. It is calculated from 
    h = cot(fovY/2);
    
    w is the view space width. It is calculated from
    h = w / Aspect
    If you look at "-zn*zf/(zf-zn)" with Znear == 0 you will get W~0. So later in pixel pipelene you Z value will be calculated as Z=Z'/W -- where Z' - is camera space Z -- so precision lost.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #3

    Near plane

    Thanks, now i realize.

Bookmarks

Posting Permissions

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