Graphics Reference
In-Depth Information
Figure 3.41. The generation of point sprites from point primitives.
Instancing Geometry
The final feature of the geometry shader that we will examine is its ability to perform in-
stancing. As mentioned above, the number of instances of each primitive to create is stati-
cally declared with the instance attribute. The individual instances can then be identified
by the SV_GSInstanceID system value semantic. This is a fairly generic ability, which can
be applied to many different situations. For example, one point sprite can be instanced and
offset from another to amplify the number of particles that appear in the final rendering,
while keeping the number of particles in the system to a smaller amount.
Another good example of how to use this functionality is to simultaneously create ge-
ometry for multiple render targets. This is especially effective when the geometry for two
render targets must have different transformation matrices applied to them, as is the case
in cube-mapped environment mapping or dual-paraboloid environment mapping. Separate
instances of a primitive are created, which can be transformed and sent to the appropriate
render target. This would eliminate repeating all the processing that would have been re-
quired prior to the geometry shader stage if two full rendering passes were needed. 2 2
3.8.4 Geometry Shader Pipeline Output
We have discussed many ways to use the output vertex streams of the geometry shader, and
noted that these output streams are the mechanism by which the geometry shader passes its
results down the pipeline. However, we have not discussed in detail what the vertices that
are appended to the output streams can contain. Since the geometry shader stage occurs
immediately before the rasterizer stage, it must produce vertices with the SV_Position
2 2
This geometry shader instancing technique is implemented in the sample program for Chapter 13, which uses
the dual-paraboloid environment map method.
Search WWH ::




Custom Search