Graphics Reference
In-Depth Information
is possible for transparency rendering only when the fragments are sorted front-
to-back. In order to meet both requirements for the described techniques, we
consistently sort in decreasing order and obtain a front-to-back ordering by in-
verting the usual depth value of a fragment: if the depth z of a fragment is a
float in the range [
1 , 1], we transform it in the pixel shader into the integer
,where S is a scaling factor (typically 2 32
1or2 24
1).
Our techniques rely on a buffer in which all the fragments are stored. We
call it the main buffer . Each fragment is associated with a cell in the main
buffer where its information is recorded. Our techniques comprise three passes:
a Clear pass is used to initialize memory, then a Build pass assembles a list of
fragments for each pixel and finally a Render pass accumulates the contribution
of the fragments and writes colors to the framebuffer.
The four techniques differ along two axes. The first axis is the scheduling
of the sort: when do we spend time on depth-sorting the fragments associated
with each pixel? The second axis is the memory allocation strategy used for
incrementally building the per-pixel lists of fragments. We now describe these
two axes in more detail.
S (1
z ) / 2
1.1.2 Sort Strategies
We examine two strategies for sorting the fragments according to their depth.
The first one, Post-sort, stores all the fragments during the Build pass and
sorts them only just prior to accumulation in the Render pass: the GLSL shader
copies the pixel fragments in local memory, sorts them in place, and performs in-
order accumulation to obtain the final color.
The second strategy, Pre-sort, implements an insertion-sort during the
Build pass, as the geometric primitives are rasterized. At any time during the
rasterization, it is possible to traverse the fragments associated with a given pixel
in depth order.
Both strategies are summarized in Table 1.1.
Each has pros and cons: In the Pre-sort method, insertion-sort is done in
the slower global memory, but the method affords for early culling of almost
invisible fragments. It is also faster when several Render passes are required on
the same A-buffer, since the sort is done only once. This is for instance the case
when CSG models are sliced for 3D printing [Lefebvre 13].
Pass
Rasterized geometry
Post-sort
Pre-sort
Clear
fullscreen quad
clear
clear
Build
scene triangles
insert
insertion-sort
Render
fullscreen quad
sort, accumulate
accumulate
Tab l e 1. 1. Summary of the Post-sort and Pre-sort sorting strategies.
Search WWH ::




Custom Search