[an error occurred while processing this directive]

Setting up and rendering illumination in Brazil r/s.

Part 1. Brazil tools review


Brazil: Image Sampling

Parameters in the Brazil: Image Sampling tabbed page are used to control antialiasing (AA). Aliasing involves a wide spectrum of artifacts in rendered images, the main reason of their appearing being discrete values used for analog quantities. The most known effects are jagged object edges, grainy semi-tone transitions (for example, at borders with soft shadows), blinking in animations, etc. There is a mathematical theory developed to eliminate these effects. It lies in refining color values of pixels by disjointing them into constituent parts – subpixels, emitting additional rays through the subpixels and approximating results to the whole pixel. The ground for disjointing a pixel into subpixels is the color difference value between neighboring pixels or subpixels. The process of disjointing pixels into subpixels and emitting additional rays is called supersampling. There also exists undersampling, when one color-determining ray is used for several pixels. Undersampling is used to accelerate calculations when the color of a given area changes rather slowly, so that it can be reproduced accurately enough by interpolating by several control points.

Brazil uses adaptive supersampling. It means that you can specify a fork of values for minimum and maximum number of rays per pixel and a threshold contrast value, which will change the number of supersampling rays within the specified range when necessary.

Pic. 4 Supersampling controls

Min Samples – minimum number of rays per pixel or pixel group. Its values are the powers of 2, so 0 means that minimum 1 ray will be used for each pixel to determine color. Negative values will result in undersampling, that is one ray will be used to determine color of a pixel group. In case of values greater than 0 (1 and greater), a pixel will be disjointed into subpixels right away (to be more exact, into a matrix of n x n subpixels, where n is the power of 2 from Min Samples). That is 2 or more rays will be used to determine a color of one pixel.

Max Samples – maximum number of rays per pixel or pixel group. It can also take negative, 0, or positive values. Both parameters have the bottom limit of values of 4 (one ray for a 16x16 matrix) and the top limit of 8 – not more than 256x256 subpixels and corresponding rays can be used to determine a color of one pixel.

The most widely used Min/Max Samples values: -3 0, -2 -1 or -2 0 for previews; 0 2, 1 2, 1 3 for final renders.

Low Contrast – it turns supersampling into adaptive supersampling. Sample color on the right helps you define the contrast value. You can specify the contrast for each RGB channel separately or specify the common value of illumination intensity change by setting the value parameter in the HSV imaging model. Contrast value is used by the brazil engine to decide whether to increase the number of supersampling rays. Here is the algorithm. Firstly, a color is calculated for a pixel or a pixel group according to Min Samples. Then the values of calculated colors of neighboring pixels (pixel groups or subpixels) are compared. If the color difference exceeds the value specified in Low Contrast, the number of rays is increased twofold. It means that the pixel will be split into 2 subpixels, (a group of pixels or subpixels is halved). Color values are again calculated for the new rays and the entire process is repeated. The cycle ends if the difference between neighboring pixels gets less than the contrast value, or if the maximum number of supersampling rays specified in Max Samples is reached. If the contrast is set high, supersampling will most likely involve minimum number of rays. If the contrast is low, supersampling will most likely involve maximum number of rays. You should choose the contrast value for a final render assuming that the human eye can distinguish colors differing 3-4 color grades.

New color values determined for subpixels of a single pixel are used to calculate the refined pixel color. Various filters in the Image Filter group on the Brazil Image / Texture Filtering tabbed page are used for this purpose.

Pic. 5 AA Filters

In other words, filters are rules, which are used to determine a pixel color by its subpixels' colors. It should be noted that there is a conclusion in AA theory that a pixel color depends not only on the color of its subpixels but on the color of neighboring pixels as well (ideally – on all neighboring pixels). Many filters used in brazil for AA take this issue into account. The most universal of all available filters is Mitchell-Netravalli. It provides quite a good quality, rapid calculations and detail level. Each filter is shortly described in a text box a little below the list of filters.

Jitter Samples – A ray, which is used to determine a pixel (or subpixel) color, usually goes through its center. It very often leads to the appearance of patterns, known as moire. To avoid this undesirable effect, the ray can be allowed a random deviation from center instead of being emitted through the pixel center. Jitter Samples parameter sets random deviations for each AA ray.

P1, P2, P3 buttons are preset Min and Max Samples values with constant contrast value.

Thus, the selection of Min and Max Samples, Low Contrast values and a filter determines the method and quality of AA.


Igor Sivakov (igsiv@mail.ru)

December 2, 2004

[an error occurred while processing this directive]