Graphics Reference
In-Depth Information
One of the major challenges we faced was to find a way to give artists full
control to define where and how much volumetric light should be visible in the
scene. We also wanted to add the possibility of animating the intensity of the
volumetric light to create more natural-looking effects. In this chapter we will
describe how we used particle effects and a special 3D scattering amount lookup
texture to make this possible.
We also needed to find a way to deal with transparent objects in our scenes.
The problem here is that transparent objects are either rendered before or after
the volumetric light effects. If the transparent objects are drawn first, the vol-
umetric light effects will occlude them. If the volumetric light effects are drawn
first, the transparent objects will occlude the volumetric light. We will show how
we store the intensity of the volumetric light in another 3D texture and how we
use this data to composite the transparent objects into the scene.
Our render engine uses deferred rendering [Valient 09]. This means that the
scene is rendered in multiple phases. In the first phase all information of the
scene's geometry is gathered in the so-called geometry buffer (G-buffer). The G-
buffer contains all information needed to light the scene, such as surface normal,
albedo color, roughness, reflective color, etc. In the second phase all lights are
rendered into the lighting accumulation buffer. For each light a polygonal shape
is rendered that will cover all pixels that will be illuminated by the light. The
shape is rendered using a shader that will sample all information from the G-buffer
and perform the proper lighting calculations for each pixel. All light shapes are
rendered additively to the lighting accumulation buffer to form an image of the
lit scene. All techniques described in this chapter are applicable to any type of
rendering method; however, some implementation details will only be relevant to
deferred rendering engines.
3.2 Basic Algorithm
To render the volumetric light effects, we start by rendering a shape for each light
that represents the light's volume. For point lights we will render a sphere and
for spot lights a cone. For the sunlight we will render a fullscreen quad, as the
volume of the sunlight covers the entire scene. We render each shape with a special
volumetric light shader. For each pixel the shader will calculate the line segment
of the view ray that intersects the light's volume. We then enter the ray-march
loop, which takes multiple light contribution samples across this line segment.
Artists can define the number of ray-march steps we take on a per-light basis. For
each ray-march step the sample position is calculated, and the sample is lit using
the same code we would normally use to light the geometry. When performing the
lighting calculations, we assume we are lighting a completely diffuse white surface
that is facing the light direction to get the maximum contribution of the light at
the sample's position. Because we use the same code that is used to calculate the
Search WWH ::




Custom Search