Graphics Reference
In-Depth Information
8. Next, use interpolation source texture
tex2DInterpolationSource
to update
the stencil
tex2DEpipolarStencil
and mark these samples, for which we
will execute ray marching. For all these samples, the interpolation source
indices are the same, which is how they can be detected. Note that all
culled samples are not processed.
9. Perform ray marching for all the marked samples. The resulting in-scattering
is rendered to
tex2DInitialInsctr
texture (which previously contained coarse
in-scattering and is now reused). Details can be found in Section 2.8.4.
10. Next, the initial in-scattering
tex2DInitialInsctr
is interpolated on all eipo-
lar samples using interpolation source texture
tex2DInterpolationSource
andisrenderedto
tex2DEpipolarInscattering
.
11. Finally, in-scattering from
tex2DEpipolarInscattering
is transformed from
epipolar space back to rectangular and added to the attenuated back buffer
(Section 2.8.5).
Important details of the stages are presented in the following subsections.
2.8.2 Sample Refinement
The sample refinement stage generates the interpolation source texture
tex2DIn
terpolationSource
, which stores the indices of the two samples on the same line,
from which the sample will be interpolated. This stage is implemented with a
compute shader and consists of two steps. On the first step, a shared-memory
array is populated with 1-bit flags indicating if there is significant difference in
coarse in-scattering (loaded from
tex2DInitialInsctr
) between each two adjacent
samples in this segment. Flags are computed as follows:
float3
f3MaxI
=
max
(
max
(
f3I0
,
f3I1
), 1
e
−
2) ;
bool NoBreak
=
all
((
abs
(
f3I0
−
f3I1
)/
f3MaxI
)
<
Threshold
);
The flags are packed as 32 bit uints using
InterlockedOr()
. On the second
step, the interpolation source samples are identified using
firstbitlow()
and
firstbithigh()
intrinsic functions. They return the bit position of the first
nonzero bit starting from the lowest-order bit and the highest-order bit, respec-
tively.
2.8.3 1D Min/Max Binary Tree Construction
We store min/max binary trees as a
SM
Dim
×
N
Cascades
)
RG_16UNORM
texture
tex2DMinMaxDepth
, which contains all trees for all slices in all shadow
cascades. As discussed in Section 2.7.2, each 1D height map cannot contain
(
N
Slices
·