FiringSquad: Home of the Hardcore Gamer - Games, Hardware, Reviews and NewsSubmit your own or view users' CPU overclocking results!

  
 Home   News   THE MATRIX   Deals   Hardware   Games   Features   Media   Products   Forums   FS China 
AddThis Social Bookmark Button

Home : Guides : Articles : FS 3D Guide: Geometry and Bumps
» Join the Greatest Gaming Community NOW! (It's free)

Already a member? Login
 


Random Gallery >> 
Click to view high-res Image!
Demigod Review [30] (0)

EVGA: my number 1 (0) by imagination
BioShock Review(Preliminary #2) (3) by Hyper
13.1 miles of EVGA (0) by Odoyle721
So what if it doesn't follow the topic? (0) by ICDP
An EVGA Collage (0) by Samuel71
Half Life 2 (Round 2) *runs* (8) by exe3
OverClocking Boot Camp (3) by Odoyle721
"I need a vacation..." (4) by ICDP
War! Huh! Yeah! (aka Blatant Plagiarism) (1) by ICDP
Never fallen (0) by froggz

More Blogs >>




FS 3D Guide: Geometry and Bumps
June 11, 1999   James Yu > [View My Other Articles]
Product Info | User Reviews | Article Images(2) | Image Gallery | Comments | Forum Thread
Z and Depth Buffering

It's the last letter of the alphabet

Here's a good Z-buffer definition from Cirrus' website.

A Z-buffer involves a block of memory equal to the display resolution (e.g. 640x480) multiplied by the number of bits of depth resolution desired (e.g. 16-bits). The Z-buffer algorithm stores a depth value for each pixel in the display. When rendering objects, the engine calculates a Z-value for each pixel and stores that value in the Z-buffer memory location corresponding to the X/Y address of the pixel in the display buffer. The lower the Z-value, the close the object is to the viewer. When a new pixel is rendered its Z-value is compared with the Z-value of the current pixel and only if the Z-value of the new pixel is less than the one already stored will the new pixel be written to the display buffer.

The Z-buffer takes up part of the frame buffer, and it speeds up games by telling the graphics processor not to render objects that aren't actually in view, specifically objects or parts of objects which are covered up by other geometry. Z-buffer depths range from 16bit to 32bit, and it can take up as much memory as an extra frame buffer.

So you can see from here that your average 16MB video card can take up around 7MB on the frame buffer, and up to 7MB for Z calculations. That doesn't leave too much for texture memory!

Stencil Buffer

Stencil bits are stored in the Z-buffer. It's usually only 1bit or 8bit. The stencil allows applications to "tag" various regions of the frame buffer.

Stencil Buffer Masking

The stencil buffer can tell the video card what it's allowed to redraw. For example, let's say you have an air simulation game where the view is from the cockpit. It would be a waste to render the cockpit interior every frame, right? Well, the stencil buffer will make sure that the cockpit interior doesn't get redrawn.

When the scene is first drawn the video card sets the stencil buffer write mask to a number greater than 1, and draws the cockpit interior tagging it with the >1 stencil number. Now the rest of the scene is drawn with a stencil tag of 0. The stencil buffer tag will tell the video card to only redraw where it sees a 0 in the stencil buffer. The cockpit interior with the >1 tag will always be skipped. Programmers can just clear the stencil buffer whenever they want to redraw the pixels in the cockpit interior.

Back! Texturing needs RAM too     Bumpy bumpy Next!
Blog + Share: Digg Del.icio.us Reddit SU furl • More: AddThis Social Bookmark Button

Send This Article to a Friend!  
Table of Contents
  Print Entire Article  

MATRIX CONTENT » RANDOM MEDIA BLOG More Blogs >>
No ratings yet
» Please rate this
I am an AMD AgentRead this Media-Blog entry!» How to Overclock Guide (2)
by SuperCharge (4) Talk with this user on their Shout Box (My other blogs) Posted 6 months ago


 Hottest Topics
BioShock 2 special edition includes vinyl LP (12)
ATI Radeon 5970 Performance Preview (12)
Modern Warfare 2 PC outsells Call of Duty 4 (11)
First Fermi-based Tesla board announced (9)
New Bad Company 2 trailer released (9)
Today's News >>
Today's Siteseeing >>


 Table of Contents


 Random Fact
Quake 3 and Unreal both use stenciling to create dynamic, realistic shadows.


FiringSquad is powered by... Back to Top Site MapContact UsAdvertise With Us Privacy StatementAbout Us  
News RSSSiteseeing RSSArticle RSS   © 1998-2009 FS Media, Inc. All Rights Reserved