Pages

Thursday, 8 September 2011

Best Vray Setting: Indirect Illumination

Here is the second part of renderstuff.com Vray tutorial

This tutorial answers the following questions:
- What is the indirect illumination?
- How do indirect lighting looks in nature?
- How does the global illumination differ from the secondary?
- What are the diffuse reflected rays?
- How the GI algorithm implemented in computer graphics?
- What are the primary bounces and how they differ from the secondary ones?
- How the hemispheric diffuse reflections look schematically?
- How to setup the GI in Vray on practice?
- How the global illumination affects the overall scene lighting?
- What is color bleeding and how to fight with it?
- What are the GI caustics?
- What are the correct values for the primaries and secondaries?

best v-ray engine settings 2.1 by renderstuff

Introduction

To understand the setups of indirect illumination in V-Ray and any other render engine it is worth to find out what is indirect illumination, and why it is important to photo-realistic rendering.
Global illumination is one of the modern rendering engine algorithms, which adds to the final image an additional render element. For ease of understanding of the rendering engine, the simplest way to imagine forming of final image is as it obtained by superimposing separate render elements, such as shadow, color, light, information about transparency, etc. each on other according to certain rules. That is to imagine the final rendering as a collection of separate images with different information. Those who know Photoshop can compare this process with the overlaying of different layers with a specific blending mode. Indirect illumination is one of the render elements, which adds to the overall result the information about the indirect light present in scene. To understand more exactly, what is added to the final image with this element, let us learn what the global, secondary or indirect illumination is in principle.

Indirect illumination in nature

Indirect illumination is the illumination of the objects by the diffusely reflected light only, without direct light from the actual light source.

If you put some object in front of directional light source, such as window, and bring to the dark side of this object a sheet of white paper, you may notice that this dark side will be much lighter.
Bring closer and move away the white sheet from the unlighted side of the object several times, and you may see the difference in the final illumination of the surface with and without light sheet. The effect of lighting by a piece of paper would be even more obvious, if there are no objects around, which are as light-coloured as this paper sheet.

diffuse reflection indirect global lighting illumination in real world concept
 
Demonstration of the diffuce reflection effect in nature. The not lit directly side of the object becomes lit if we bring the white material close to it. This is happening becuse of the indirect illumination or global illumination, how it is named in computer 3d graphics.
 
Why is this happening? Why does one object become brighter, if it appears beside the other bright object?

This happens because the effect called diffuse reflection. Bright object simply reflect rays falling on it from the light source. Therefore, reflecting, they illuminate the dark side of another object. Because of its origin, due to the fact that these rays are reflected and come from other objects, rather than going directly from the light source, they are called indirect. Accordingly, the light that is created by these rays, called indirect, that is, Indirect illumination.

It is easy to guess that ray, reflected first time from an object, also are reflected an enormous amount of times from other nearby objects. This avalanche-like process happens with all illuminated objects, eventually creating a set of reflected and interreflected rays in all directions. Each subsequent reflected light ray carries less energy than previous ones because it is partially absorbed by the object from which the ray is reflected. Consequently, the light ray is fully faded. Due to the fact that this reflected light significantly illuminates even those sites that are not illuminated directly from a light source, that is, illuminating the global environment, this lighting part is called Global illumination or shortly GI.

Global Illumination in Computer Graphics

Of course, all the photorealistic render engines are capable to simulate the global illumination, in some way calculating the first and subsequent reflections of light from objects in the scene, taking into account not only the color of these objects, but also features of their materials, such as transparency and reflective properties.

Let us see how indirect lighting looks like in computer graphics on concrete examples.
For this example we have created a simple scene in 3ds Max.

3ds max scene vraylight chamfer box sphere standard material properties
 
The structure of the example 3ds Max scene. It is the rectangular room with the square window opening, in which the VRayLight is set. Inside the room there are the ChamferBox and the Sphere. The walls have diffuse texture with other standard propetries. Thebox and sphere have purely white color in the Duffuse color slot. This scene is created for representing the features of the Global illumination and its influence on the overall lighting on the 3d rendering.
The screenshot above shows that it is a rectangular room with a window opening into which the light source is set. Indoors near the window there is ChamferBox with little Fillet radius, and usual Sphere next to it. All materials in the scene are completely mat, without any reflections, even blurred. The materials of this scene have only the texture maps; the materials of cube and sphere are the standard materials with white color in the Diffuse slot.

scene rendering direct light no indirect light dark areas in result
 
The rendering of the example scene with direct light computation only. The global illumination is not enabled here. Image shows the unnatural dark areas, which may appear in the areas that have no direct light falling on them. The absense of the diffuse interreflections leads to dark in not directly lit places.
 
This is the scene rendering. Note that only the direct rays from the light source illuminate it, without the use of GI. For clarity, one of the rays is shown schematically as a green arrow.

As can be seen on image, highlighted are only the areas of direct contact with the light rays. They are the floor and ceiling near the window opening, part of the wall near to the cube and the upper part of the wall opposite to the window opening where the arrow represents the light ray. Nevertheless, despite the presence of a bright source of light in the window and well-lit parts of the room, the scene still has a lot of unnatural dark areas. For example this is a wall with a window opening, visible to us the face of the cube, and the area right to it.

As seen from the screenshot of 3ds Max viewport, next to the cube is a completely white sphere. However, it absolutely is not visible.

Of course, in the real world, in such a situation it will be perfectly visible, even if it is not exposed to direct light rays.

natural rendering with direct and indirect light both scematic light rays demonstration
 
Realistic rendering of the example scene. Rendering was performed with the direct light and indirect light enabled. The previously dark areas became lightened because of global illumination, The arrows show the path of light travelling, The direct light shown in green strikes the opposite to window wall and lits it. Then, the reflected from the wall light lits the sphere that is not in reach of direct light. This is shown with the red arrow named Primary bounce. Then, light reflecting from the spehre and lits the bottom of the wall. This is shown in blue arrow called Secondary bounce.
 
This picture shows the same scene, same settings, the same source of light and materials, but it has a global illumination. You can clearly see that the scene is much brighter. A wall with a window opening has become lighter, as well as the visible face of the cube; in addition, now is clearly visible the white sphere, which on the previous rendering was in complete darkness.
To understand the effect of indirect lighting, look at the conventional Direct Light ray from the direct light source. As mentioned earlier, the indirect illumination is an effect of light rays reflection from all objects. The global illumination simulates exactly this effect in computer graphics. Ray of light comes from its source and hits the wall opposite to the window opening. Then, indirect illumination picks the baton so rays do not disappear, they are reflected, bouncing off the wall, falling onto the sphere. The red arrow conventionally represents it. Thus, the primary bounce happens from the scene object, and light falls on the sphere, of course, illuminating it. After that, the ray is reflected again, this time from the sphere and strikes the bottom of the wall behind it and, again, highlights it as well. This is shown schematically by blue arrow.

Number of secondary reflections of the ray is not limited to two bounces. They can be much more, depending on the settings the renderer. Also, it should be understood that each ray from the source of direct light upon reflection splits into many secondary rays of light. This amount also depends on the specific settings. In the above example the set of rays into which a ray of direct light breaks, not shown merely to simplify the scheme. More detail, the scheme of the diffuse reflection of the ray resembles turned over dandelion:

diffuse reflection hemisphere dendelion direct light reflects in many directions primary bounces
 
The sceme of the diffusely reflected light eays scattering. The green arrow represents original light ray, whic after hitting the surface reflects in a number of bouncing rays. The directions of the reflection are disturbed in a from of dandelion, i.e., forming the hemisphere. The number of the rays in the hemishpere can be controlled by the special parameter in 3d computer graphics.
 
Original ray from the source of direct light, which shown with green color, hits the surface, then form secondary rays, shown in red. These secondary rays reflect from the surface diffusely, that is by scattering to the set of rays in all directions. In turn, these are already reflected rays, striking the other surfaces, in the same way, each again forms a set of rays, and so on and on. Global illumination ray can bounce many times, depending on the number of bounces, defined by the parameters of the renderer. Based on the image above, it is easy to imagine that they form a hemisphere, similar to a half of dandelion inflorescence. Vectors of the rays diverge in all 180 degrees in different directions, by the hemisphere from the point of reflection. That is how the rays behave in the GI engine, and because of the shape of the reflection, they are called Hemispheric Rays.

It should be noted that bounces of light rays of the global illumination in V-Ray is divided into Primary bounces (first reflection), and Secondary bounces (all subsequent ones). The first ray bounce from the object scene called the Primary bounce not without reason. The whole point is that the rendering engine that simulates the behavior of the real world sets the fading of the rays as they reflect. Therefore, as happens in the real world, the first bounce bears much of the reflected light energy. The energy of this first primary bounce is so significant that it much more than the light energy of all subsequent reflections together. It one affects the illumination of the scene greater than all subsequent ones. Conversely, in view of their lesser importance, all the bounces that follow the first primary one, called the Secondary bounces.

Practical GI setting up

Well, it is time to figure out how to actually manage global illumination in the V-Ray.
Open the Render Scene window (key F10) and go to the Indirect illumination tab.
In this tab, the general manager is the V-Ray:: Indirect Illumination (GI) rollout. It controls global illumination, rendering algorithms, the choice of primary and secondary bounces engines and general settings of GI.


screenshot v-ray indirect illumination on gi caustics post processing primary secondary bounces
Screenshot of the Vray indirect illumination parameters rollout, which is in the V-Ray tab of the Render scene 3ds Max window. This rollout has the one enabling On checkbox and four zones, First GI caustics zone, Post-processing and two similar zones Primary bounces and Secondary bounces. There are such parameters as Relfective, Refractive, Saturation, Contrast, Contrast base, Multipliers and GI engines drop-down lists.
 
First, to enable global illumination in a scene we should set tick in the checkbox named On. After this, we have available parameters of the V-Ray global illumination engine.
In first GI caustics area we can enable or disable the so-called reflective and refractive caustics for GI rays.

In short, caustic is the place where the reflected or refracted rays from the reflective and transparent curved surfaces are gathered, drawing a specific clearly visible light patterns. In other words, this is the effect of the curved lens, projecting the light rays on some surface, where the lenses are the reflective and transparent objects of the scene. The most obvious example of caustic is fancy light pattern on the table near the glass, on which the light shine from a side.
 
It is these effects simulates caustics photon map, situated in the V-Ray:: Caustics rollout. Despite the fact that current rollout is the last in the Indirect illumination tab and logical to write about it as the very last thing we would like to briefly write about it right now. The calculation of caustics in the V-Ray is accompanied by the appearance of a large number of artifacts, excessive consumption of memory and complex pre-configuration. All this is for the minimally noticeable, and often absent effect in most scenes. n the universal starting V-Ray configuration, rendering caustics should not be enabled.

However, it should be understood that the calculation of caustics and GI caustics are two different things. Caustics, created by the aforementioned photon map can be calculated only for direct rays of light. While GI caustics are calculated separately. The GI caustics configuration area in the V-Ray:: Indirect Illumination (GI) rollout are responsible exactly for these caustics, which are originated from the global illumination. Moreover, GI caustics are called caustics only by a certain analogy with photon caustics, in fact, they are not.

Option Reflective allows us to enable rendering of reflective GI caustics for GI bounces, allowing GI-rays to take into account the reflective properties of materials and better reflect from reflective objects such as chrome, mirrors and other.

Given the lower energy of indirect bounced rays, compared with the rays from sources of direct light, the effect of reflective caustics on the overall scene illumination is negligible. In addition, since the need to render Reflective caustics by renderer, their inclusion will increase the render time of global illumination. Moreover, taking into account the complexity of this effect sampling, the appearing of unwanted noise in the GI is possible. Considering mentioned drawbacks, this option should be nominally left off in the universal starting V-Ray configuration.

Refractive option allows us to include rendering of refractive GI caustics for GI bounces. Despite the similar name to the caustic from the direct rays of light sources, where it simulated caustic lighting effects, Refractive caustics simply allows the passage of secondary illumination through the transparent surface. For example, this applies to the interior scene, which is illuminated by the indirect illumination from VRaySky / skylight / Skylight portal, located behind the window, and window openings are models of windows with glass. Lack of calculation of Refractive caustics in the scene will render all black, simply because the GI rays will not fall into the interior, because they not are able to pass even through the transparent glass window.

For most scenes, such behavior is unacceptable and therefore GI option Refractive in universal V-Ray settings should be activated by selecting the checkbox Refractive.

The next area of the V-Ray:: Indirect Illumination (GI) rollout is Post-processing, which contains three parameters.

Saturation is a very important parameter of GI, which is responsible for the color saturation of reflected light or, as practice shows, simply for the value of the so-called color bleeding effect.

color bledding 3ds max vray red cube red scene
Rendering of the slightly modified example scene. All left unchanged but the material of the central cube. It is red now. Image represents the effect of color bleeding, which leads to lighting the all scene in the color of the inside objects. The scene is colored red because of the presence red cube in it.
 
This image is a rendering of used earlier scene, with the same light source, with the same material objects, with one exception, the material of the cube is red.

There is no need much time to look closely to the image, comparing it with previous ones to realize that not only the cube, but other scene objects got a reddish tinge. This effect is quite common for the real world, and actually is the phenomenon of color bleeding.

Its nature is quite simple. Red object is an object that absorbs the rays of all colors and reflects only the red color rays. It is this effect clearly imitated on this image. Direct rays of white color, which, as we know, bears all the colors of the visible spectrum, falling from a window on the surface of the cube, and then reflected. But they no longer reflected white, as they were originally. They are reflected red, as red material of a cube absorbed all the colors except red. Thus, the red cube lights nearby objects and paints them red.

Get rid of this often too evident effect helps the lowering the Saturation parameter. A lower value makes the color saturation of diffuse reflection paler, while the larger value makes it richer.

That is the same scene with the same red cube, but with a value of Saturation, equal to zero:
ger rid of color bleeding saturation parameter gi lower
Rendering of the example scene with the red-colored cube inside it. The parameters of the rendering set so the Satureation of the GI lighting set to zero. This means the diffuse GI reflection do not have any color contrast. Image shows there is no color bleeding effect at all even with the big red cube inside the room.
 
This image is no longer has red walls, but it should be understood that this is a global setting that affects every diffuse reflectance in the scene, reducing the color saturation of all GI rays. In most cases, a strong understating or overstating of this parameter gives an unnatural result. Optimal for the vast majority of the scenes is the value of this parameter equal to 0.7. That it must be set in the universal starting V-Ray configuration.

If there is a need to correct the effect of color bleeding of any particular object or material, for local control of this aspect the VRayOverrideMtl should be used. This is eloquently demonstrated by a very good example of V-Ray Help.

 Contrast and Contrast base are the parameters that literally control the contrast of GI, which renderer uses in forming of the final image, similar to how Saturation is essentially just controls color saturation of GI. Contrast parameter works in conjunction with the Contrast base. Technically Contrast base is one of the variables of the algorithm that computes the contrast of GI render element, shifting the range of its values, thereby affecting its brightness. When Contrast base is zero, increasing the value of the Contrast parameter brightens GI; at the Contrast base greater than zero, the overall brightness is increasing, and increasing of the Contrast parameter value leads to darkening of GI.

In practice, these parameters are easily viewed as an analogue of instrument Brightness/Contrast of raster editor, Photoshop. In the vast majority of cases, there is no need to somehow change the contrast of the GI. Therefore, in starting V-Ray settings, their value should not be changed, leaving 1 for Contrast and 0,5 for Contrast base, as it is set by default.
The next area of V-Ray:: Indirect Illumination (GI) rollout is a zone of choice of engines for Primary and Secondary bounces of the light rays.

The number of GI settings causes panic to many 3d visualization artists. In fact, in these settings everything is fairly logical. There are primary and secondary bounces of the ray. Both are computed with special GI engine algorithms. There are four GI rendering algorithms in V-Ray. Their choosing can be compared with the choosing of antialiasing algorithms. There is one uncompromising calculation algorithm of GI bounces called Brute force and three slightly more flexible algorithms: Global photon map, Irradiance map and Light cache.

In areas of Primary and Secondary bounces, there are only two parameters, a numerical Multiplier parameter and GI engine dropdown list.

Multiplier is a value of the current light bounce GI render-element applying intensity in formation of the final image. Simply it is its brightness.

By default, to Primary and Secondary bounces Multiplier values are set equal to unity. But this is not the most successful value, because of the excess brightness of the GI rays compared to the direct light rays. The images with these values are noticeably overbrighted and have no contrast. Often, it affects shadows much, which become lighter, so on rendering it immediately causes the effect of "flying" objects, under which the familiar shadows are absent.
gi multipliers primary secondary bounce defalut 1 values incorrect balance
Example scene rendering with the default Multiplier value for the indirect illumination, the Primary and Secondary bounces. Image have the overall bright lighting what is quite unusual for real world. There is no correct balance between the brightness of the direct light and the reflected indirect.
 
Look closely at this image. It is quite bright, but all details of the scene are slightly visible, they appear blurred and fuzzy. This occurs because the indirect light lights the shadows, and thus greatly reduces the detail of the scene, making it flat. In scenes that contain objects of saturated colors, the value of Color bleeding is also increased, owing to the greater color influence of GI-rays on the scene. Also, it is not very clear what is the source of light in this scene, because there is absolutely no contrast between the bright light from the window and just as bright indirect lighting. There is an illusion that somewhere inside the room is an additional source of light. Nevertheless, very different picture can be observed on the image with a successful global illumination multiplier value.

gi render elements correct values 0,85 0,7 right balance direct indirect light
Rendering of the example scene with the correctly set Multiplier values for the GI render-elements. The image is now looks natural, with the details. The correct light balance lets have the photorealistic brightnesses for the direct and indirect lights.
 
In this picture, the right balance between the intensity of the direct light from the light source and indirect lighting in a scene is chosen. Look at how clearly visible light background, there is no doubt that it is a source of light from the window, not the improvised indoor sources. There are also visible details much clearer; the scene becomes juicy and well worked out in detail. This approach significantly enhances the image contrast, making it more photorealistic. If the image seems not bright enough, this is elementary solved by raising the total Multiplier value in the V-Ray color mapping settings, located in the V-Ray: color mapping rollout of V-Ray tab in Render Scene window. More details about the global adjustment of final render brightness you can find in Replacement the VRayPhysicalCamera with Standard tutorial.

If you want only a minor refinement of overall rendering brightness, it is much smarter to alter it in 2d graphics editor. In addition, as mentioned in the first tutorial of the best V-Ray settings series, adaptive behavior of V-Ray render-engine is heavily dependent on the brightness of the image calculable. This means that calculation of the lighter GI inevitably lead to more time for rendering of the final image. For these reasons, we should choose the correct meaning of the brightness of GI. Rational and the most suitable for the vast majority of scenes and situations are the values of 0.85 for Primary bounces and 0.7 for Secondary bounces. These values should be used in the universal starting V-Ray configuration.

GI engine are drop-down lists where we can choose one or another algorithm for rendering bouncing rays. In order to understand what algorithms should be used for Primary bounces and what for Secondary bounces, we need to become better acquainted with the each of them.
 
In this lesson, we became more familiar with some important aspects of setting up the V-Ray renderer, in particular with the tools of V-Ray:: Indirect Illumination (GI) rollout, as well as with the theoretical basis of global illumination and its essence in the real world.
Dear friends, we sincerely hope that after carefully reading this lesson, you are much closer to understanding the essence of GI and the important role it plays in photorealistic computer graphics.

In the next tutorial, we will learn about the particular implementation, the principle of work and detailed configuration of two algorithms for calculation GI, Brute Force and Irradiance Map.
All have easy settings and beautiful 3d renderings!

See you next tutorial, check for updates, and certainly support us by purchasing liked excellent premium 3d models :) You can do it!

Your questions and suggestions about this tutorial feel free to write in the comments, and we respond to help you.

4 comments:

  1. hi! i have a problem with cove lighting applications,

    http://www.mediafire.com/?9sv3w2v6lfm4ii1

    in this image the light inside the cove are bleeding thru the ceiling itself, may i ask how to fix this kind of issue?

    i am using su2013 + vray 1.6

    thanks!

    ReplyDelete
  2. This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog..
    Chandeliers

    ReplyDelete