Setting up and rendering illumination in Brazil

Igor Sivakov writes: Brazil possesses rather flexible and state-of-the-art illumination
calculation capacities, though it’s not the fastest renderer. Brazil
has its own shader engine with universal interface. This engine is not
as intricate as that in Renderman or in mental ray, which rely on
programming necessary properties rather than on a library of ready
shaders. However basic shader types in brazil have enough properties
for a high-quality reproduction of material properties of the widest
spectrum. In the production scale it makes brazil Choice #1 for small
and medium studios, which have network rendering capacities and cannot
or do not want to program their own shaders. However, brazil has a lot
of sincere fans among individuals as well

Introduction

Laying aside purely artistic criteria, successful 3D scene render is determined by three main factors. These factors are good modelling, interesting materials, and lighting. And if modelling is out of the capacity of rendering programs, then materials and lighting are their direct responsibilities. These days there are several programs specializing in materials and lighting calculations. The most famous: mental ray, Vray, brazil r/s, finalrender, this list is constantly growing. Brazil takes its own worthy place among the modern rendering programs. Brazil possesses rather flexible and state-of-the-art illumination calculation capacities, though it’s not the fastest renderer. Brazil has its own shader engine with universal interface. This engine is not as intricate as that in Renderman or in mental ray, which rely on programming necessary properties rather than on a library of ready shaders. However basic shader types in brazil have enough properties for a high-quality reproduction of material properties of the widest spectrum. In the production scale it makes brazil Choice #1 for small and medium studios, which have network rendering capacities and cannot or do not want to program their own shaders. However, brazil has a lot of sincere fans among individuals as well.

The object of this article is to review the main features and configuration peculiarities of illumination in brazil. And though we shall not review shaders in detail here, their influence on illumination will also be described where necessary.




A little theory

Modern rendering algorithms allow to calculate many properties of real illumination. The entire calculation is usually divided into calculations of three main components. The first component is the calculation of direct illumination of objects from light sources, including lengthy objects in the line of sight. The second component, conditioned by reflection properties and material transparency, takes into account reflected or refracted illumination. At last, the third component ? secondary illumination, conditioned by multiple diffuse reflections of direct light between object surfaces. Algorithms for calculating all the three components are well known and described in detail. That’s why I will only provide their basics in order to preserve the continuity of the article.


All the three components are calculated separately and then are combined into one total result. The process starts with emitting rays from the camera (viewer) through a two-dimensional array of pixels, which form a future image, into the scene. The first cross point with the surface of a scene object is calculated for each ray. Then, the mentioned illumination components are calculated for all cross points. The total number of rays from the camera is specified by the antialiasing settings.

Direct illumination is calculated by emitting additional rays from each cross point in the direction of all light sources in the 3D scene. In this process the program determines whether the point is illuminated or in the shade and calculates distance to the light source and the angle between the direction to the light source and the normal of the cross point between the surface and the camera ray. If the scene contains not only spot lights, but also linear, area, or volume lights, a group of rays is emitted in their direction instead of a single ray, in order to determine to what degree the point is illuminated as the illumination total of different parts of the light source. This procedure allows to calculate “soft” or blurred borders between the shadow and light (penumbra). Area lights are the most widely used light sources in practice.

Reflected and refracted lights near the ideal refraction and reflection angles (mirror reflections) are calculated by means of raytracing. If the object surface possesses mirror reflection properties or transparency in the point it’s crossed by the camera ray, another ray is calculated in the direction of ideal reflection and refraction angles or both, if the surface possesses both properties. New rays are traced to the next cross point with the scene object, where the procedure may be repeated, if the new cross point also possesses reflection/refraction properties. Rays from the starting point are traced until the specified raytracing depth is reached (the number of ray refractions specified in renderer settings). Or until the illumination contribution of the ray becomes less than a certain value. Illumination of the point from reflections and refractions is determined as a total illumination of all rays traced from this point. Modern modification of this algorithm allows to calculate diffuse reflections and refractions. This can be done because several rays are emitted from the starting point (instead of a single ray) in the range of angles close to the ideal reflection/refraction angle. Illumination of the point is calculated by approximating illuminations from these rays according to some principle. As those rays are coming apart as the distance from the point grows, approximation will give an increasingly blurred result with the increasing distance or when going through other reflecting/refracting surfaces.

Diffuse multiple reflections are calculated in two ways or both of them combined ? Monte-Carlo method and/or Photon Maps method.

Monte Carlo method takes into account cumulative multiply reflected light in a given point, except for the direct light and mirror reflections/refractions. For this purpose a semisphere is built around the point (a sphere, if the surface material is transparent) with rays (called “samples”) emitted though its surface in random directions. Light source directions and mirror reflection/refraction angles are excluded from the set of samples. Each sample is traced until it crosses with the environment. Each new cross point must have its illumination calculated, that’s why the process must be repeated ? direct illumination calculation, mirror angles tracing, building semisphere and new samples to calculate indirect diffuse illumination.

It’s easy to understand that sample emission is avalanching in its effect. For example, if you use 50 rays to sample a point visible from the camera, each ray may give up to 50 new points. In its turn each point will produce 50 rays, each giving 50 point more, etc. If you do not limit the multiple reflection depth, the calculation process may take up very much time. That’s why in practice, the multiple reflection depth is limited either in renderer settings by specifying the tracing depth of secondary reflections or by the minimum contribution value, which may be taken into account. Besides, sampling all bounces, excluding the first one, is less exact ? with fewer rays.

Totalling illuminations returned by samples allows to estimate the total illumination of the point visible through the camera with more or less precision. The more rays are emitted via the sphere, the more exact the estimation will be. Classic Monte Carlo method (MC) requires ray directions to be absolutely random. In practice, almost all renderers use a modified MC method, so called Quasi Monte Carlo (QMC). Its main difference is that ray directions are pseudo-random. For example, so-called low discrepancy sequences may be used to determine the directions. They allow to choose ray directions so that the sum of returned illuminations totals a certain value. Importance sampling is also widely used. Among all possible ray directions this method chooses only those that contribute most to the global illumination. Very often sample directions are determined using photon directions taken from the photon map near the point. Various interpolation methods can be used to get illumination of some points without calculations, using already known illuminations of calculated points. The main usage of these methods is to accelerate calculations without losing quality. Point illumination calculations using Monte Carlo method are rather slow, though they may be very precise.

The second way to calculate secondary diffuse multiple reflections is Photon Maps method. In this case the entire calculation process starts from emitting rays (photons) from light sources instead of tracing rays from the camera. Each ray is associated with a certain energy portion, which value is determined by properties of the light source. Photons are traced until they cross surfaces a specified photon reflection depth. If a surface crossed by a photon has nonzero diffuse properties, this collision event (collision coordinates, energy and photon vector) is written into the database called a “photon map”. Photon map is necessary to calculate the secondary diffuse illumination of a point when the rays are traced from the camera. This is done in the following way. When a camera ray crosses a surface, photon map records by collision coordinates are taken instead of building a sphere and emitting samples. The algorithm determines the quantity of nearest photons and estimates the point illumination by their cumulative energy. What photons will take part in the estimation of point illumination is determined by the photon search radius or by the number of collected photons, which are specified directly in renderer settings.

Photon maps method is a very quick calculation, which is physically correct at that. But it has two significant shortcomings. The first one ? unreasonable for these days memory requirements. Infinitude of photons must be emitted to obtain correct results. Each record about a photon collision in the database requires approximately 30 bytes. In practice the maximum number of photons is limited by the memory capacity, which can be addressed by the operating system. For Windows XP SP1 and Win2k this limit is 2?GB (no matter how much RAM is installed in the computer), for Windows XP SP2 this limit is a little higher, being 3?GB. The second shortcoming of photon maps is their discreteness ? each collision is characterized by a single 3D coordinate and a single energy value. This leads to difficulties in calculating illumination of corners and joints using only the photon map and to the blurred light-and-shade as a result of approximation of photon energies within the search radius (otherwise the render will not be smooth but “spotted”).

There has been recently made attempts to improve the photon map method. For example, they almost managed to lift the limitation on the number of emitted photons due to modified method of calculating contributions of photon energies into point illuminations. It’s a light map for Vray and tone map for brazil, which should appear in the next versions of these programs. But the question about approximation is still left unsettled ? no research is carried out in this direction as far as I know.

That’s why the combination of the two methods is used in practice to calculate secondary diffuse multiple reflections. Namely, quasi- Monte Carlo method is used to calculate illumination from the first diffuse reflection ? a semisphere is built in the cross point of the camera ray with the surface, and sampling rays are emitted through its surface. Photon map is used to calculate diffuse multiple reflections for each sample in its cross point with another surface, direct illumination calculation and possibly ? calculation of mirror reflections and refractions. The last component is often neglected.

That’s all about the theory. It’s quite enough to understand the main settings for calculating illumination in brazil, to which we now proceed.


Setting up and rendering illumination in Brazil

Spread the love
blank