Global
Illumination Sampling / Undersampling QMC
By: Dave Lamb
In this section, you will learn
how global illumination is sampled, and how
[Shade Rate] (otherwise known as "undersampling")
affects sampling, and the final result of
your image.
Start off by downloading and opening the sample
scene.
Max 3.x users:
Open the file undersampling_start_max3.max. Click
here
to download this file
Max 4.x and 5.x users:
Open the file undersampling_start_max4.max. Click
here
to download this file
You should now see a scene such as the
one in Fig. 1.
Fig 1
This scene rendered as is should look like Fig.
2.
Fig 2
As you can see, global illumination is not enabled,
and there is no light bouncing around the
scene.
Now that we want to start working with global
illumination, check [Indirect Illumination]
in the "Brazil: Luma Server" rollout in
the "Render Scene" dialog. Fig 3 shows
the initial settings for the scene. This
will activate several more options. [View
Rate] is how many global illumination samples
are taken per shaded light point. You'll
learn about [Shade Rate] in the next part.
[Bounces] is literally that, how many bounces
the light is allowed to make. We'll leave
this at 1, since it renders the quickest.
The [Sec Rate] is the sample rate used when
the given pixel is either reflected, or refracted.
A flat reflective surface (such as a mirror)
is a good example. The back wall or objects reflected by
the mirror will have this given sample rate for global
illumination. Caustics will not be affected by the [Sec Rate],
unless of course the caustics are seen
through (refracted) or off (reflected) an
object.
The "Indirect Energy Filters" section
is how intense each bounce is, for diffuse, or
specular. Increasing this too much will make
the scene 'overblown,' too bright, but as
you can see, ours is at 1.8, since there's
only one bounce we're compensating for lost
energy.
After checking [Indirect Illumination], pushing
render should give you the result in Fig.
4.
Fig 3
Fig 4
You can see that the final result isn't very
pleasant, since it's very grainy. This is
because the [View Rate] is set very low.
[View Rate] is how many rays are traced
per light sample. If you increase the [View
Rate] to 15 and hit [Render] once again,
it should look like Fig. 5. You can see
that now it's quite smooth, but is still
lacking the quality of a final production render.
Fig 5
Take a few minutes to experiment with different
[View Rate] settings, but beware, because
the [Shade Rate] is set to 0/0, render times
may climb steeply. I'll explain how [Shade
Rate] works in the next part.
Shade
Rate - A paradox
You may have already experimented with the shade
rate, and since the default [Shade Rate]
is -3/0 you may have already seen it without
noticing. [Shade Rate], or "undersampling"
is used to spread out more than one light
sample over a given number of pixels(-1
is 2x2 pixels, -2 is 4x4 pixels, -3 is 8x8
pixels, etc.), and blends in between them.
Many believe that undersampling is a bad
thing, since you aren't giving each pixel it's
own light sample, and in turn, makes you think
that the image lacks in quality, when in fact
undersampling works for you.
Take the sample scene for example. You can see
that there isn't much detail in it, there
is plenty of plain smooth surface to it,
and in turn it would make sense that more
than one pixel should share a light sample,
since there is no need to take more samples
than we have to. The next figure shows the
scene with a [View Rate] of 15, but the
[Shade Rate] at -3/0(min/max). It now looks
like it's a heavily compressed JPEG image. I believe
that this is the main thing that turns people
off from undersampling, the initial test image.
Fig 6
It does have a few things going for it however,
smoothness and speed. As you can plainly
see, it is rather smooth, even though it
is blotchy, and the render time compared
to the last render without undersampling
is a fraction(1:25 with vs. 11:39
without).
Now set the samples to 45, click on the Contrast
box in the [Shade Rate] properties, and
set it to 10,10,10(RGB) and render again.
Contrast is actually how much contrast is
needed before the [Shade Rate] brings the
min. rate up one level. It's the beauty of
the system, and allows for adaptive sampling.
The reason we brought it down is to make
sure there is no sample aliasing (artifacts
around sharp edges) in the scene.
Fig 7
Render time of 13:48. 2 minutes longer than the
other image, but much much smoother, and
near perfect (no anti-aliasing, though).
Take the time to play around with undersampling,
and sample rates, once you get the hang
of it, you'll never want to go back.
Knowledge is
Power
There are some other things that are nice to
know when using GI and undersampling.
When using undersampling, beware of bump maps.
If you undersample too much, your bump maps
will not seem to come out as much as they
should, especially with pure GI, such as
a purely skylight lit scene. To solve this
problem, make the max [Shade Rate] 1 or
2, and if the bumps still aren't coming out
enough, bring up the min [Shade Rate].
Don't over-do it. Undersampling a scene too
much will give you unwanted results. If
your scene has plenty of detail, don't use
-4/0 for instance.
Try not to bring the max [Shade Rate] any
lower than 0. This means the very maximum
a sample point can get is greater than 1x1
pixels, and will give your gi an aliased
look.
Diffused Light
- A Simplified Model
Each sample is composited of many smaller samples,
taken around the scene, very much like the
way a raytraced reflection is taken, except
this method samples the illumination in
the scene by scattering many rays out from
the sample point.
Fig 8. Many samples taken around the
scene to get a diffuse level.
The [View Rate] in Brazil r/s is how many of these
samples are taken per shaded light point.
Given this method, you can now see why scenes
with large amounts of contrast end up very
grainy/blotchy. The more contrast there
is in a scene, the more rays that must traced
for a given sample point to include all
the brightest points in the scene. A good
example of this is object lights. You may
have played with object lights, and noticed that
the smaller you had made the light, the more samples
you had to use to get a smooth image.