Lecture 6: Rasterization Pipeline (15)
CactusPuppy

If we utilize integers, we may end up with some issues with rounding, since items are rarely some integer distance away. Thus, two objects that are very close together depth-wise may end up in front or behind each other due to floating point imprecision and other such things. I believe this is what causes the phenomenon known as Z-fighting.

andrewyli

From Wikipedia: "Another technique that is utilized to reduce or completely eliminate Z-fighting is switching to a logarithmic Z-buffer, reversing Z." (idea being closer to 0 = more precision).

anthonyhsyu

How would we sort n triangles in linear time? Or do we say it's O(n) simply by going through each triangle, replacing pixels as necessary when we find a triangle that is closer (in turn not actually sorting the triangles)?

ariel-hi

If I understand correctly, sorting the triangles is unnecessary. No matter the triangle order you will produce an image following Z-Buffer rules. Different orderings may produce slightly different images because of tie-breakers. Professor refers to something here as brute force. Would that be the "lazy" nature of not needing to sort the triangles?

jk0524

I think the difference between painter algorithm and z-buffer is like sorting a list and only finding the minimum of the list. In the case of visibility, we only care about rendering the closest pixels.

jessicajyeh

@jk0524 is correct! The z-buffer stores the minimum z value so far at an (x, y). No sorting is needed if you only track the min.

You must be enrolled in the course to comment