Graphics Reference
In-Depth Information
of CPU and GPU resources. This approach has been covered in many articles,
but its main limitation is that it is not well suited for covering vast amounts of
terrain. In order to solve this problem, we considered the question: what does
one actually see when they look at grass in the distance? You do not see many
individual blades of grass nor any detailed grass movement. What you do see
is some general noisy movement, wind patterns, and some grass blades only at
boundary regions (where the grass stops and the terrain changes to some other
material). From these observations we decided to implement our grass using noise
in screen space.
The beauty of this technique is that it is extremely cheap, it is very realistic,
it does not require any additional resources or preprocessing, it scales beautifully
over an entire terrain, and it can extend to vast distances into the scene. It is
also very easy to integrate into existing rendering pipelines.
This technique does not cover nearby grass rendering, where individual grass
fins are actually visible. Near grass rendering is a very well covered topic, and
we encourage the reader to see [Pelzer 04] and [Whatley 05].
1.3 Technique
Screen-Space Grass (SSG) is rendered in post-processing as a fullscreen quad. It
requires some kind of per-pixel depth information that we get from camera-space
position , but it could also be used for rendering pipelines without it (by reading
depth information some other way or by ignoring obstruction detection).
The complete algorithm consists of two stages:
1. terrain stencil masking,
2. post-process fullscreen pass.
When rendering the terrain, we must stencil-mask it with a unique stencil
value. We use a stencil mask value of 2 for terrain and 1 for everything else.
During post-process, we execute a fullscreen pass with our SSG shader. The
SSG shader samples two textures: the scene's color buffer and a position texture
(or a depth buffer from which a position may be derived). The color texture is
used for color sampling and a smudge effect, and the position texture is used for
grass scale and object obstruction detection.
SSG should be computed after the opaque rendering stage and lighting are
complete, so that we have a final framebuffer color, but before edge detection,
fog, and other post-processing effects.
1.3.1 Generating Realistic Grass Noise
To generate grass noise we use a simple vertical up-down smudge. It is a very
simple idea that produces realistic grass noise and edge fins.
Search WWH ::




Custom Search