Skip to main content
gamedev.net
🔒 Locked

question about rendering triangles

Started by monguin61 Jul 5, 2006 at 9:37 PM 1 replies 400+ views
Original Post
monguin61
monguin61
This will probably sound like kind of a dumb question, but if someone can just give me a quick answer, my confusion should be sorted out with no trouble. I understand most of the algorithms needed to store, manipulate, display (et cetera) 3D graphics, but there's one thing I've never really been sure about. When you have a full scene, ie, not just a single, simple model, and it comes time to display all your triangles, what is the method that current games and other programs actually use? Most of the books I have on the topic are kind of outdated, and I'm just curious as to how its actually done. To the best of my knowledge, there are two basic techniques, z-buffer, and sorting the full list of (non backface) polygons by depth, and drawing all of them, far ones first. Honestly, I can't imagine that the latter technique is actually feasible, so I assume that current games use some form of a z-buffer, but I'm just not sure. Enlighten me, anyone?
nts
nts
All current graphics cards out now support z buffering (since pre Geforce1?), no real time renderers/games out there are sorting per triangle.

The depth buffer is all handled on the graphics card and the programmers mainly don't have to worry about it. The graphics cards also use several techniques to speed up the z-testing, such as depth compression (Hyper-Z, etc). This makes them very fast at rejecting pixels that aren't visible.

For example, Doom 3 first renders a depth pass where only the depth (z) buffer is written to. The lighting passes after it only write to the color buffer (where z_buffer_depth = current pixels depth). This ensures that no pixel will be lit that isn't visible.

Sorting front to back can be beneficial in many cases but isn't done per triangle rather per batches of triangles. Same goes for rendering, all major rendering is done in batches.

Hope that helps
monguin61
monguin61
Yes, you answered my question completely, thanks a lot.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.