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:
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:
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:
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.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
There are only 10 types of people in this world; those who understand binary and those who don't.
Bookmarks