Monday, March 3, 2008

Critical VRay Settings

At first i would like tell you that v-ray is a 3ds max plugin which makes 3ds max to render more accurately


Introduction
To say that VRay is a complicated program would be an understatement! Ironically enough,
however, it has become the most ubiquitous engine in the visualization industry because of,
among other things, its simplicity. Although it contains a large number of settings which should
ideally be separated from critical settings and grouped into an advanced section all alone, it is
nonetheless a fairly easy program to digest when you know which settings are critical and which
can be left for exploration down the road.
We believe knowing VRay means knowing how to troubleshoot your scenes. When you render a
scene, you either get a result you want or don’t want. If you get what you want, great - but if you
don’t, and don’t know how to fix a problem, such as blotchiness, noise, flickering, etc, then you
are bound to spend precious time testing numerous settings. Even when you do get the results
you want, you may not realize that you can achieve the same or better results in less rendering
time.
Rather than explaining the critical settings in a top to bottom manner, starting with the top-most
rollout and ending with the bottom-most, this discussion presents VRay features in a more logical
manner, from most critical to least critical. For example, there is an option to disable glossy
effects in one of the first rollouts, Global Switches; however, it wouldn’t make sense to discuss an
option for a concept that has yet to be explained. Therefore, such a setting is reserved for later.
For the purpose of this discussion, we are defining critical settings as those which tend to require
attention at least once during the course of a typical visualization animation. This means that
while a particular setting’s use may not be guaranteed during any given visualization, its use will
probably have been at least considered as an option because of its special qualities or
characteristics that it offers a user. By the same token, having not listed a setting does not at all
mean that it is not something worth exploring, but rather it is a setting most likely not as widely
used, as unique in its affect, or as practical in a production environment. At the end of Part II of
this discussion are a few ‘gee-whiz’ type features that may not be as practical as those presented
earlier, but are nonetheless, interesting enough to make mention.

Indirect Illumination
When light strikes an object, it illuminates the object with Direct Light. After direct light bounces
off the object, the light illuminates other surfaces as Indirect Light (also known as indirect
illumination, global illumination, or GI). GI in a scene is approximated through the use of complex
algorithms that require an incredibly large number of calculations to complete. Like all advanced
render engines, VRay has several options for making this approximation and each has their own
distinct advantages and disadvantages. The Indirect Illumination rollout controls which methods
are used.
Within VRay, indirect illumination is categorized into two areas. Indirect illumination that is
directly visible by a camera’s view or visible in the reflection and refractions from other objects is
referred to as a Primary Bounce. Indirect illumination that simply used in the overall calculation
of GI in a scene is referred to as a Secondary Bounce. VRay uses several different methods to
approximate these bounces and each contains parameters that control the quality of the
approximation and the time it takes to make the approximation. This discussion looks into the
most widely used primary and secondary bounces types; the Irradiance Map and Light Cache,
respectively. We’ll return later to see which settings in this rollout warrant further discussion as a
critical setting.


Irradiance Map
An irradiance map is a method for storing the calculation of radiant energy, or light, which strikes
a set number of points in 3D space. With a 3D point map of these stored illumination values,
VRay can approximate the amount of illumination that arrives at every point on every surface, and
thus, better determine how to color the pixels in a rendering. What makes algorithms behind the
irradiance map method so great is that they approximate GI more accurately in areas that require
more detail, such as shadow transitions and places where different surfaces interact, and less
accurately in areas where greater detail is not necessary, such as areas with unvarying
illumination. To do this, VRay renders a camera’s view in a number of different passes, starting
with a lower resolution pass and progressively adding higher resolution passes. With each
successive pass, VRay determines if the GI of each area of the rendered view is adequately
approximated by samples taken in the previous pass. If so, no further samples are taken – if not,
more samples are taken. With each pass, the resolution of the irradiance map pass is doubled,
and therefore, VRay can potentially quadruple the number of samples taken. It would be
impractical and far too time consuming to calculate a sample for every pixel in the rendered view,
so instead, VRay takes what it believes is the required number of samples (to approximate the
GI) and interpolates (or estimates) the areas in between. The results of these samples are stored
in the irradiance map and the accuracy of the irradiance map is directly dependent on the number
of samples and the quality of those samples. The settings in the top part of the Irradiance map
rollout (shown below) control both of these factors, while the bottom half deals with animations.

HSph. subdivs
The next most critical setting in the rollout is the Hsph. subdivs value. At each point that a
sample is taken, rays are traced out from the sample, mathematically speaking, to determine the
amount of light arriving from each direction and improve the quality of the GI approximated at
each point. The more rays that are traced, the more accurate the sample becomes. In simplistic
terms, if you place a virtual hemisphere above each sample that is taken and trace rays from the
sample through each subdivision of the hemisphere, the more subdivisions, the more rays that
are traced. The image below gives a very rough graphical representation of this process. The
actual number of rays that are traced are equal to the square of the Hsph. Subdivs value,
although this can change depending of settings with the QMC Sampler rollout (discussed later).
By default, HSph. subdivs are set to 50, however, this value is often much higher than necessary
and can lead to excessive render times. Because of the impact this setting can have on both
quality and render times, some experimentation may be in order. At good value to start with is 20
and if no problems exist in the GI of your scene, then you should not increase the value. If
problems such as splotches arise, then experiment with small increases in this value. Values
above 50 should be avoided because of the increase in render times that result (at the benefit of
indiscernible gain or gain that can be achieved through other settings with smaller render times).
Likewise, values below 20 should be avoided because the savings in render times are not worth
the great loss of quality that can result.

Image Sampler
With the exception of post-rendering effects, the final step in any rendering process is
antialiasing. Aliasing is a term to describe imperfections in the rendering process caused by color
changes that are too drastic, and that occur over too small an area of screen space to be
adequately depicted by the pixels that define that space. Anti-aliasing techniques attempt to
smooth jagged edges by properly handling fragment pixels (i.e., adjusting the pixel color
according to the amount of pixel coverage). VRay supports all standard 3ds Max filters and for
more information on which ones should be used for any given scene, refer to the Insider article
entitled Antialiasing and its Side Effects. But before antialiasing can be performed, VRay has to
sample each pixel to determine what objects in a scene lie within the boundary of each pixel and
what color the objects are in the area of each pixel. The image sampler is the tool used to do
this, and therefore, it plays a critical role in the final rendered output of a scene. Without the
necessary imager sampler configuration, high quality settings in so many other areas of VRay
and 3ds Max are negatively affected.

Adaptive QMC sampler
The Adaptive QMC sampler works similar to the Fixed sampler except that, like any adaptive
setting, it adapts to its environment and applies a range of possible subdivisions based on the
Min and Max values used. In areas of less detail, the Min value may be used and in areas of
greater detail, the sampler is more likely to use the Max value.
By default, the Min and Max values are 1 and 4 respectively, which provides decent quality for
test purposes. However, these values will often need to be raised for production renders. Values
such as 3 and 6 are typically good settings for most production purposes. Caution should be
taken in using higher values than 6 because of the possibility of excessive render times.
Additionally, it’s a good idea not to separate the Min and Max values by more than 2 or 3. Doing
so can result in a wide range in quality of detail because it leaves VRay more room to guess
incorrectly.

Adaptive subdivision sampler
The Adaptive subdivision sampler is unique in that it is the only sampler that allows you to take
fewer than one sample per pixel. Notice that instead of using a Min / Max subdivs. setting, it
instead uses a Min/Max rate. Instead of describing the sampling as subdivisions of a pixel, it is
saying that pixels are sampled at the rate of ____ pixels for every 1 sample. A rate of 0 means
one sample per pixel. A rate of 1 means 4 samples per pixel. Conversely, a rate of -1 means
that pixels are sampled at the rate of 4 pixels for every 1 sample. Because of this capability, you
have the capability of greatly reducing rendering times in a scene. However, the adaptive
subdivision sampler does not work great for all types of scenes. This sampler should be
restricted to use in scenes that contain few blurry effects and a minimal amount of highly detailed
areas. In scenes with large areas of smooth surfaces, this sampler works great.

Light Cache
The light cache is arguably the most widely preferred secondary bounce engine among VRay
users, not only because of its great mixture of speed and quality, but also because it’s very
simple to use. The light cache does not have variables that control adaptive behavior like the
irradiance map and because of this alone it is a much simpler solution with fewer variables having
a large impact on its use.
The light cache has numerous advantages over the other options for secondary bounce engine
types, but it primarily boils down to quality versus speed and to achieve the same level of quality
with the other types, the settings have to be adjusted so high that their rendering times will almost
always exceed that of light cache.
Subdivs
The light cache works by shooting virtual rays from the camera and the Subdivs value directly
controls the number of rays that are used. The actual number of rays that are propagated is
equal to the square value of this setting. A good way to see this is to set both the primary and
secondary bounces engines to light cache, enable the Don’t render final image option, and
render a scene with a small number of subdivs. In the image below, for example, the Subdivs
were set to 3, and therefore, 9 samples were used.

No comments: