Game Development Reference
Using alpha-testing to kill pixels of the geometry to be hidden [Vlachos 10]:
This technique offers flexible per-pixel geometry hiding. However, it has
the following disadvantages (most are already listed in [Vlachos 10]):
It is not very ecient as the hidden pixels will execute their pixel
shader even though alpha-testing might kill them, and pixel processing
cost is not saved for hidden pixels.
The use of alpha-testing may interfere with early-Z optimization on
some GPU architectures (e.g., Playstation 3 RSX) and thus results in
reduced depth-testing eciency for the entire rendered object.
The technique evaluates a parametric ellipsoid for each damage area
in the shader. This puts a practical limitation on the number of eval-
uated ellipsoids, which in turn limits the number of damaged areas
that may appear on a single object at once (only two were allowed
in [Vlachos 10]).
Killing pixels in the shape of an ellipsoid results in curved cuts that
are dicult to fill accurately with replacement damage geometry. The
workaround (which our artists found inconvenient) is to add a thick
edge or “lip” around the actual damage geometry to cover the empty
areas between the ellipsoid and the damage geometry.
The second part of the problem is the rendering of damage geometry in an optimal
manner. Although this part of the problem is not as challenging as the first part,
it can still benefit from some optimizations that we will cover in this article.
Implementation Description and Details
From the previous section one can conclude that finding an optimal solution for
the problem is not a straightforward task, but there are a few lessons that can
be learned to reach better results:
It is more ecient to hide geometry by triangle culling than per-pixel
Per-pixel culling makes it dicult for artists to fill the gaps.
If support for an unrestricted number of damage areas is needed, then the
calculations must be independent of the number of damage areas; otherwise,
performance will increasingly suffer the more damage areas are supported.
On a high level, the approach we propose can be summarized by the following
1. Authoring step. An artist paints groups of polygons on the mesh with vertex
colors to mark them as “hide-able.”