www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/08/06:13:41

Message-ID: <D1FB30BBA491D1118E6D006097BCAE39238876@Probe-nt-2a.Probe.co.uk>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: What is Z-sorting?
Date: Wed, 8 Apr 1998 11:12:12 +0100
MIME-Version: 1.0

>> Lately I have been hering about somthing called Z-Sorting. What is
>> it?
>
> Z-buffering is an algorithm used to remove hidden surfaces when
> displaying 3d surfaces.  The x and y coordinates (plotted on the 
> screen) and the z coordinate (projected into the screen) is placed 
> in a buffer. Through sorting of these z coordinates hidden surfaces 
> can be removed for fast display.  As I understand it, z-buffering 
> is built into some 3d accelerator boards.

You just described the depth sort algorithm, also known as a z-sort: 
this is a totally different thing to a zbuffer.

Depth sorting is a very crude algorithm, where all the polygons in
a scene are sorted by distance from the camera and then drawn from
back to the front, so that closer polygons will cover up others that
are further away. This works fine for things like flight simulators
where there are large distances between objects, but there are some
cases that it just can't handle correctly, where polygons intersect
or overlap in some interleaved patterns.

A zbuffer is a 100% accurate sorting method, where you store the 
distance to each pixel as it is drawn, so that subsequent pixels can
be tested and only rendered if they are closer than whatever else
has already been put in that location. This tends to be quite slow
when implementated in software, but is very easy to support directly 
in hardware.

For a proper discussion of things like this, comp.graphics.algorithms
is the place to go.

	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019