Normally we still want to draw opaque objects from front to back even using depth buffer.
This is because nowadays hardware supports early-z to kill hidden pixels, which could reduce workloads of pixel shader.
sinood
if we have the depth values of each pixel precomputed, we can loop over the n triangles and assign a z-value based on the depth value of each.
See the z-buffering pseudocode here, which computes the z-value at each pixel:
https://en.wikipedia.org/wiki/Z-buffering
Normally we still want to draw opaque objects from front to back even using depth buffer.
This is because nowadays hardware supports early-z to kill hidden pixels, which could reduce workloads of pixel shader.
if we have the depth values of each pixel precomputed, we can loop over the n triangles and assign a z-value based on the depth value of each. See the z-buffering pseudocode here, which computes the z-value at each pixel: https://en.wikipedia.org/wiki/Z-buffering