Radiosity in LightWave - an Introduction
From the release of LightWave 3D v9.2, there are now two and a half different methods for radiosity calculation. The first one is Monte Carlo, the second Final Gather, and the 'half' is background radiosity. Backdrop radiosity is a special variant of the Monte Carlo method, hence the 'half'.
Each of these three variants can be used with the interpolation and caching options, for various uses, speeds and levels of quality and physical accuracy, giving you a broad range of control options to suit your particular needs. It will pay off taking the time to understand the difference of these methods in order to get fast, clean and accurate results. Good radiosity settings will get you fast and smooth results. Bad settings are usually either slow or ugly, or both. Learning how this works is not that hard, and requires only little experimentation with a simple scene, such as the one I'm using for this explanation.
What is radiosity, and why is it so slow?
Radiosity is in simple terms the bouncing of light off surfaces to illuminate other surfaces. Global Illumination is in all practicality the same, but includes other lighting effects such as caustics, which I won't go into here. For complex scenes radiosity calculations can become one of, if not the most computationally-intensive task of producing a final result. Many methods exist to determine a radiosity 'solution', but what should be understood is that radiosity requires such a large amount of calculation to be accurate that in order to get halfway usable render times the different methods need to cut corners in order to gain speed. Selection of an algorithm is therefore dependent on the purpose of the project. I'll outline the properties of the methods shortly, without going into the actual workings of the algorithms themselves.
For the examples below I'm using a scene modelled to real world scale (this is important) and is 3.2m high. It has a backdrop gradient from red to blue, and Adaptive Sampling is turned on (as this is such a smart system, it's unreasonable to expect you not to use it).
Below I'll discuss the following five points:
The following diagrams might help in understanding the different settings for each method and option:
- Intensity = The intensity of the radiosity solution. Important to master this setting, as it for instance simulates more bounces than you actually have.
- Rays Per Evaluation = RPE, explained below
- Bounces = The amount of light bounces that will be used in the calculation
- Tolerance = explained below
- Minimum Evaluation Spacing = MES, explained below
- Minimum Pixel Spacing = MPS, explained below
This diagram shows the situation for a RPE of 3, which is of course silliness but makes it a little clear. The real algorithm shoots rays from the evaluation points, not towards them (as in this diagram), but I didn't want to turn the arrows around. As they were protesting. And stuff.
Remember, this is only a diagram, this is not how it actually works under the hood. So don't schwoon over to Mark Granger at a cocktail party and challenge him for a battle-of-the-radiosity-wits, because... you'll end up wet.
In general, Monte Carlo is the slowest but most accurate way of radiosity calculation. It is important to realize the differences between the different types and the shortcuts other methods take. In the following image, you can see why you would use Monte Carlo over FG or BDO. In the box a dielectric lens is placed, and a bright box a little further away. The MC method refracts the light correctly, bounces the red and blue light properly and delivers a believable image. FG mumbles the colours and does nothing of the sorts, and results in a render without caustics (the focused spot on the wall where the lens focused the light in the MC render), and the BDO render shows that it uses the MC method, but lacks bounces to make it useful in this situation.
The Monte Carlo Method (MC)
This is the easiest to understand radiosity method and it is a highly accurate but slow method to calculate radiosity. It fires sample rays for each pixel in the scene (basically the MES is 0 and each pixel is an evaluation point). It is a physically accurate method, and deals with transparency properly by maintaining the angle and colour of the penetrating rays. It is used by various engineering packages to calculate light, but also fluid, thermal dynamics and so on. Monte Carlo can be considered a brute-force method, although it's a bit smarter than that. It will always be correct, but depending on your settings may be too grainy. Monte Carlo uses very little memory to operate as its operation doesn't depend on or interacts with other samples much. Monte Carlo can therefore be faster than other methods if the memory requirements for these other methods are high.
Monte Carlo can be used with the 'interpolated' switch discussed below, in which case the MES and MPS settings become available. Read the Interpolated section below to understand this powerful but more complex feature to cut down on render times drastically.
RPE: Amount of bounced rays fired per sample ray (see diagram up there).
Strategy: The result of Monte Carlo when improperly set is never splotches, but always noise (if no interpolation is used, which we'll assume for now). Getting a noiseless MC render can take quite a bit of time, and requires the right amount of rays to be set (the only setting it has), so it works well in combination with the new Adaptive sampling system, which will detect noise above its tolerance level and shoot extra samples to remove them. Setting the rays to very high is therefore very silly, and will guarantee you will be rendering much longer than necessary. Set them low (not too low) and let the AS system take care of it. MC is not very well suited for animation unless you bake the solution using the baking camera, because it's so slow. There might be instances you want to choose MC over other methods for animation, for instance for exteriors, it's sometimes even faster, or for very complex scenes where the memory usage of other methods causes it to slow down a lot.
The below example shows three MC renders with differing numbers of rays. As you can see, the low amount of rays causes more grain (up to the 0.05 tolerance I set for the AS system)... Using AS for MC is very valuable, because a low ray render will be augmented by the AS system, therefore only using up as many samples as needed, and the high ray render will be wasting time on rendering areas that were smooth enough as it was. I added one render (far right) to show the graininess that would result from a AS 0.02 render instead of the AS 0.05 render. As you can see, it looks nearly identical to the 1000 rays MC render, except that it is much faster.
The Final Gather method (FG)
The second algorithm to calculate radiosity in LightWave 3D is Final Gather. This is provided as an alternative to Monte Carlo, and is considerably faster, at the price of less physical accuracy (see bottom of page), and increased memory usage. This is a method that takes its name from similar methods in other render engines. It's not as refined (yet) as those systems and may prove disappointing if that's what's expected. It does not do any adaptive geometry sampling yet (such as KRay does), thus wastes time on large even surfaces. Nevertheless, you'll find that in most circumstances FG is faster than MC by a factor of 2 or more, due to the 'storing' of secondary bounce samples in memory, allowing the system to check for previous evaluation points and eliminating new ones when necessary. So, unlike MC, which is basically a blind algorithm, FG knows where the previous samples have been placed, and thus reduces render time by not having to redo those samples.
First, a rough and very fast pass is performed (which can be cached), for all the secondary rays, using the MES, MPS and RPE setting. Because secondary bounces are usually very faint, FG shoots very little rays and interpolates between them for these secondary light effects, speeding up the calculation enormously, especially with large amounts of bounces. Because it stores data on the secondary rays in world space, FG uses more memory than MC does. After this a pass is performed to fire the primary sample rays per pixel, using again the MES for the rays fired. This pass resembles the MC method in appearance and might produce noise.
MES: Sets the minimum/maximum balance distance between evaluation points for secondary rays. The higher this is, the more inaccurate your solution, as the rays might miss a lot of detail in the scene. However it speeds up the calculation a lot if you set it higher. Too high settings will result in very approximated results, sometimes even light leaks (image 3).
MPS: Sets the minimum distance in camera/image space between evaluation points. The smaller this is, the more accurate your solution. However it speeds up the calculation a lot if you set it higher. Settings that are too high will result in very approximated results, sometimes even light leaks.
RPE: The amount of rays fired per evaluation point. Comparable to the MC setting.
Tolerance: Determines angular confinement of the rays. Turning this value up will speed up the render by eliminating shallow rays. Setting this value too high might kill too much of the subtle bounces of radiosity.
Strategy: Because the most time for an FG render is spent in the second pass , you want to keep the RPE low, and let the AS system take care of the noise, as with the MC method and any other stochastic method used in LightWave 3D (such as the reflection and refraction blurring, Photo real motion blur and DOF).
The MES setting however should not be what you would pick for a render with interpolated turned on. If you do, you are working against the idea of the FG method, by letting the first pass do all the work. Choose a high MES, but be careful not to set it too high, as it will start making faults. For a living room for instance, where you would do something between 10mm and 100 mm for interpolated, you'd choose 500mm ~ 1m for the FG pass.
FG is potentially very effective for scenes with lots of detail that take too long using MC. The first pass of FG is cached so there's a performance gain each frame for FG versus MC. The speed gain will depend on the amount of secondary bounces/first pass (which are cached) versus the primary ones/second pass (which are not). This of course only if you turn the 'cache radiosity' option on for animation.
The Backdrop Only method (BDO)
This method is based on the Monte Carlo algorithm. What is does differently to plain MC is that it only fires radiosity rays from the background and self-illuminating geometry. It is essentially a non-bounced radiosity method. It's therefore really fast and very useful for outdoor scenes that need some quick environment illumination, like from an HDRI or a background gradient. It also does not use much memory.
Backdrop transparency: This switch enables full raytracing through transparent surfaces to allow light from the backdrop to penetrate. If left off, it speeds up the radiosity process, but you wouldn't get backdrop lighting inside a building because it would be blocked by the glass.
The Interpolated option
All three radiosity methods can be interpolated. This option is very powerful and warrants some investigation and experimentation on its own. 'Interpolated' used to be a method in its own right in LightWave before version 9.2, where it was based on the MC method. What it does is determine spots on the model in 3D space, spaced apart based on the MES & MPS setting. Whichever one is the largest gets used, which is usually MES near the camera, and MPS far away. It then fires the amount of rays set by the RPE setting for each of these spots to see what shade they should be, and averages the area in between the evaluation spots to allow for a smooth result. This potentially eliminates a large amount of evaluation spots, as radiosity does not need to be computed for each pixel on the surface. This is what the FG method does in its first pass, but with interpolated on, there won't be a second pass adding detail to the scene, making it much faster, but also potentially ugly. The more detail in your scene, the more memory it will consume, as it has to remember all of its evaluation points, smooth it out etcetera. It's a great way to preview all scenes that use radiosity, and it's good for a few purposes for final rendering. This option is by far the most powerful one and tweaking it can yeild vastly great differences in quality and render time. Most LW radiosity renders you will find will use this option.
MES: Sets the minimum/maximum balance distance in world space between evaluation points. The higher this is, the more inaccurate your solution, as the rays might miss a lot of detail in the scene. However it speeds up the calculation a lot if you set it higher. Too high settings will result in very approximated results, sometimes even light leaks (image 3 below)
MPS: Sets the minimum distance in camera/image space between evaluation points. The smaller this is, the more accurate your solution. However it speeds up the calculation a lot if you set it higher. Too high settings will result in very approximated results, sometimes even light leaks. If you increase your image resolution, you need to increase this accordingly to keep the same GI resolution.
RPE: Same as the others
Tolerance: Same as the others
Strategy: The calculation time is a balance between MES/MPS and RPE. Too low MES/MPS, and your render will be slow. For each MES point, the amount of rays set by the RPE will be fired. When you have a good MES setting, the RPE setting becomes less critical. Adaptive sampling does nothing for Interpolated radiosity to improve it, once the settings are set, there's no way to improve its quality, save for the old motion blur passes trick, which I do not recommend (its a legacy thing, and you can't use caching).
Below three examples of interpolated radiosity (FG), with MPS turned off (0.0 pixels)). The left render has too little rays fired, resulting in splotches, and the right render has too high a MES resulting in light leaks and washed out colours. The middle one has a good balance between them. Notice the render times of all three are equal.
Mixing MPS with MES will get you the fastest results with a pleasing result. MPS works well for scenes where less samples are required further away from the camera, as is usually the case. MES will then fill in everything close to the camera, and as soon as MPS becomes the larger distance, it will take over. Using MPS will allow you to use very small MES.
The Cache Radiosity option
Stores the interpolated radiosity solution in memory (only the first rough FG pass when interpolated is off) and thereby saves a lot of render time for each subsequent frame in an animation. Because it only works for information that's stored in 3D space, MC by itself cannot be cached. For each additional frame only the area that was previously invisible will be re-evaluated, so there's still a caching pass, but its much faster than the first. Caching does not (yet) work with network rendering.