2
$\begingroup$

I am currently rendering a scene in the most standard fashion possible (triangle projection and Blinn-Phong for shading)

However I am getting some artifacts:

enter image description here

As you can see the lion head is not rendered properly. Moreover, the artifacts are flickering, but the proportion of how much they flicker is proportional to the distance to the lion. That is to say. If you are close to the lion there are no artifacts. But the farther away you go the more artifacts appear. I believe this is due to Z buffer imprecision. How can I solve this?

$\endgroup$
  • 2
    $\begingroup$ What distance do you use for your near & far clip planes? $\endgroup$ – PaulHK Jul 16 '18 at 3:09
  • 1
    $\begingroup$ There are a few ways of solving this, as PaulHK mentioned, tweaking the near plane of your camera projection can help solving depth precision issues, other solutions: reversed z and logarithmic depth buffer. Here is a nice article that shows the precision of the different algorithms: developer.nvidia.com/content/depth-precision-visualized $\endgroup$ – Nacho Jul 16 '18 at 11:19
  • $\begingroup$ Planar distance is at 2000 for far and 0.01 for near $\endgroup$ – Makogan Jul 16 '18 at 18:49
4
$\begingroup$

Short answer: Move your near clip plane further away.

Depth buffer precision is very sensitive to the near clip plane distance.

Complicated answer: Use different math in your view projection. There are a few techniques that can help, some of them are outlined here:

https://developer.nvidia.com/content/depth-precision-visualized

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.