jsocol / indirect3d

The worst pure-software 3D engine ever!

Home Page:http://jamessocol.com/indirect3d

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix z-buffer depth calculations

jsocol opened this issue · comments

At certain angles sometimes this is simply wrong, and objects that should be in the foreground are not. I'm not sure if this has to do with floating point rounding issues, or there are actually incorrect calculations or comparisons in there. It tends to happen with objects at similar or overlapping depth (see the central ring and the moving color triangle), and I haven't seen as much of an issue when objects are separated in z-space. That leads me to believe the calculated z values are too close together.

  • Make sure this is using the right z coordinate, first of all, and doing so consistently. It isn't intended to be a w-buffer.
  • It may be an issue with the relative scale of the space and the current far-plane depth in the camera?
  • Consider if a w-buffer would work better.
  • Double check, while in here, that the w-coordinate in view space is correct. It doesn't seem to be quite right to me.