[an error occurred while processing this directive]

Setting up and rendering illumination in Brazil r/s.

Part 1. Brazil tools review


Brazil: Photon Map Server

Photon Map Server is the heart of photon map configuration.

Pic. 14 Photon map type selection

There are two types of photon maps – Global, used to create photon maps for calculating indirect illumination of the entire scene, and Caustic, used to calculate caustic effects of illumination for separate scene objects. This division is determined by the fact that caustic effects require high photon density, which is difficult to provide using a global photon map. High photon density is achieved due to locality, that is a caustic photon map is created for a small surface area, so that you can reach high caustic photon density even with a relatively small quantity of caustic photons emitted by a light source. You should specify a source object and a recipient object to calculate caustic effects. Any object, which surface possesses mirror reflection or transparency properties, can be used as a source. As a recipient, you'd better use objects with surfaces possessing only diffuse properties. For example, caustic effects can be calculated for a glass on a table. In this case the glass walls will act as the caustic source, and the table surface will be the recipient. If the surface of a source object is curved like a lens, caustic effect will be more prominent. The nature of caustic effects is connected with the refractions in transparent and reflecting surfaces, which focus diffuse light into a thin beam after refraction or reflection.

If the map type is active, it's indicated by a green light next to the map type. Photon map statistics are also provided here – its prospective size, the number of actually stored photons, allocated memory capacity, and the cache status of a photon map. The data change in the process of photon map generation.

Pic. 15 Photon tracer settings.

Here you can control the strategy of creating a photon map and the tracing depth – total number of photon reflections from surfaces.

Prepass Type – this parameter selects a strategy for creating a photon map. Actually, it's rather difficult to forecast the total number of photons stored in a photon map, though the number of photons emitted by the light source is always known. The reason is that when photons are reflected from surfaces, the randomness factor (aka Russian roulette) comes into play. Using a random number generator taking into account such surface properties as diffuse or mirror reflection/refraction of a material, Russian roulette determines what will happen to a photon – whether it will be diffused or reflected at a mirror angle, or will be absorbed. Indeterminate character of a photon map capacity is only amplified with the number of photon bounces increased. That's why the brazil photon server makes a prepass, emitting a small part of photons. Judging from the stored results for this small part, the program estimates the total number of photons that will be stored after all of them are emitted. This will be done, if Prepass Type is set to Map Size. The estimated figure is displayed in Map Capacity of the corresponding map type.

If the #Emitted type is selected, the photon server emits photons so that the number of photons stored in a map corresponds to the total number of photons, specified in emission parameters of light sources. It's convenient when you have to get a strictly specified number of photons stored in a map.

Splitting – this option forces the photon server to differentiate between the photons reflected from surfaces and the photons passed through a transparent surface. It helps reduce noise in caustic effects. This option is useful when used together with a caustic photon map, it is not necessary to calculate a global photon map. In the latter case, you had better disable this option, as additional memory is required to differentiate between the photons.

Diffuse Depth – maximum number of diffuse multiple reflections, which a photon can undergo. This number of reflections reached, the photon is not traced. You should take into account that each collision is recorded in a photon map. So if you specify a great number of reflections, the resulting size of a photon map can be quite imposing even with a small number of photons emitted from light sources.

Reflected Depth / Refracted Depth – the same thing regarding mirror reflections/refractions of photons. A photon record will not be stored until it reaches a diffuse surface.

Pic. 16 Irradiance Estimate settings.

This group allows to a certain degree to control estimation of the irradiance of a point visible from camera. Photon map is a database that stores coordinates of photon collisions with surfaces, photon energies, and their direction of incidence on the surface. So, when you need to calculate illumination of a surface point, the database is searched by the point coordinates for photons, which are either within the circle of the specified radius (Max Search Radius) with the center in this point, or within the specified number of nearest photons (Photons in Estimate). Energies of selected photons are added together with some weight ratios producing a point irradiance estimate. We are speaking of an estimate, not an accurate irradiance value, because estimate accuracy heavily depends on the photon map density. The higher the density is, the more accurate the irradiance estimate is.

Another important note concerns the interaction of Photons in Estimate and Max Search Radius parameters during the estimation process. These two parameters are competing – if one of them is reached earlier, the other will not be used. For example, if Max Search Radius is reached earlier than Photons in Estimate when estimating the irradiance, the photon search stops, though the actually collected number of photons does not correspond to the specified value. And vice versa. It should be taken into consideration, because the Photons in Estimate value has a direct impact on render smoothness, and Max Search Radius – on the secondary illumination accuracy.

Considering the importance of these two parameters, let's analyze their interaction peculiarities. One of the fundamental properties of a photon map is the quantitative relationship between the number of photons collected for irradiance estimation, photon map density in the irradiance estimate point, and the photon search radius. This quantitative relationship can be expressed in a simple formula:

(Actual number of collected photons) = (local density of the photon map in the irradiance estimate point) x (actual area of photon search within a circle of a given radius)

I mean actual values, because manually specified data for the corresponding parameters will not always coincide with the values, which will actually be used to search photons.

For example, you can specify 5 meters as a photon search radius, set the number of collected photons to 10, while the actual photon search radius will be much less than 5 meters even for a photon map with low density, because the condition of 10 collected photons will be reached much earlier.

Another example. If you set the number of collected photons to 10 000 and the photon search radius to 1 mm, the real number of collected photons will hardly exceed 1000 even for a photon map of a high density, because the maximum search radius will be achieved much earlier.

So, the main property of a photon map can be used to determine one of the parameters using the other two, if their values are known. Approximated actual value of Max Search Radius (a radius of photon collection to estimate irradiance) can be determined, if you know the average density of a photon map and if you specify Photons in Estimate. Approximated actual value of Photons in Estimate (a number of collected photons to estimate irradiance) can be determined, if you know the average density of a photon map and if you specify Max Search Radius. We are talking about approximated values, because a photon map density, including the search radius and the number of photons collected, will be different for different surface points. It's important to be able to determine Photons in Estimate and Max Search Radius, because render smoothness and secondary illumination calculation accuracy depends on them.

Thus, the above mentioned formula sets the direction where to search for settings depending on what render you need to obtain – just a smooth picture, or a smooth picture with accurate secondary illumination at a certain density of a photon map. And even if you don't use this formula to determine quantitative values of these parameters, understanding its qualitative content is very important to work successfully with photon maps.

It's rather difficult to devise a formula to calculate a photon map density by the number of emitted photons, and it's not necessary either. That's because the approximated density of a photon map is easy to determine in practice. I'll write how you can do it later.

Density of a photon map can be considered a unique property of a certain scene, because it directly depends on the scene geometry, properties of the surface materials and light sources. Of course, density of a photon map will also depend on the number of emitted photons, but the density of a photon map will be different for different scenes with the same number of emitted photons. One can even assume that the ratio of emitted photons and the density of the photon map will be a constant value, which will label a scene like a finger-print. But the analysis of this property is not the object of this article, so let's skip it.

Let's return to irradiance estimate parameters.

Estimator – algorithm of estimating irradiance. There are three options – Basic, Advanced, and Analysis. Basic is the simplest and the fastest algorithm out of the three, but it does not support many important functions. For example, it treats wrong thin surfaces and it cannot create mirror highlights, it calculates wrong bump map shadows. So the speed is its only advantage. It's rarely used. Advanced – full featured irradiance estimate algorithm, it can do everything that Basic cannot, but it works more slowly. This is the default algorithm in brazil. Analysis is a special algorithm for finetuning irradiance estimate settings, especially the photon search radius and the photons in estimate. Rendered using this algorithm, the program returns colors which can be used for the analysis. At present only the red color provides useful information. If there is no red color in a given area, it means that there are enough photons in this area to estimate irradiance or that there are less than 8 photons. The brighter the red color is, the bigger the error is and the higher the shortage of photons is to estimate irradiance.

Pic. 17 Image rendered in the Analysis mode. Red spots indicate insufficient number of photons to estimate irradiance – these are areas where it's impossible to collect the number of photons specified in Photons in Estimate, within the radius specified in Max Search Radius.

Search type – photon search type for an estimate near corners and joints. There are two types: Spherical and Elliptical. Elliptical is more accurate with corners, but it's slower than Spherical.

Specular – this option enables calculating mirror highlights using a photon map. This function supports only materials of the Brazil BasicMtl type so far.

Pic. 18 The other photon server settings.

Photon Energy>Multiplier allows additional control over the photon energies to configure illumination brightness in the scene. Besides, there is another photon energy control in light source settings. Developers do not recommend setting this multiplier higher than 1, because it may lead to artifacts. As an alternative you had better control photon energies in light sources.

Filtering – conic filter, which is used in estimates. It determines weight coefficients for added photon energies, so that remote photons contribute less. For a global photon map this filter provides additional smoothing of the calculated illumination, in case the filter size is correct and regathering is not used. For a caustic photon map this filter allows sharper effects, increased filter size results in blurred caustic.

Cashing – stores a photon map in RAM, which allows not to recalculate it for each render. Caching is useful when a photon map is not large in size and when rendering animations.

Photon Map Files – allows to store the calculated photon map into a file. This option is a must when setting up a photon map, because changes in Max Search Radius and Photons in Estimate do not require recalculating the photon map. That's why they can be changed while loading the same photon map from file, which is much faster than recalculating it.

File – here you specify a folder and file name to store a photon map.

Pic. 19 Direct illumination and indirect diffuse illumination, calculated using a photon map.

Pic. 20 Photon map only, photon tracing depth – 20 diffuse bounces.

Pic. 21 Regathering, the first diffuse bounce is calculated using QMC, the rest – using a photon map.

We have reviewed photon map parameters in much detail because of the very important role played by Global Photon Map in obtaining high quality illumination calculations during rendering. Summing it all up, I can tell that most efforts to set up rendering with a photon map are actually spent on choosing a photon map size (the number of stored photons) and on looking for appropriate values for Max Search Radius and Photons in Estimate.

We also need to review some source light settings, which concern photons.


Igor Sivakov (igsiv@mail.ru)

December 2, 2004

[an error occurred while processing this directive]