From BlenderWiki
Introduction
Most rendering models, including ray-tracing, assume a simplified spatial model, highly optimized for the light that enters the camera “eye” in order to draw the image. You can add reflection and shadows to this model to achieve a more realistic result. Still, there’s an important aspect missing! When a surface has a reflective light component, it not only shows up in our image, it also shines light at surfaces in its neighborhood. And vice-versa. In fact, light bounces around in an environment until all light energy is absorbed (or has escaped!). Re-irradiated light carries information about the object which has re-irradiated it, notably color. Hence not only the shadows are “less black” because of re-irradiated light, but also they tend to show the color of the nearest, brightly illuminated, object. A phenomenon often referred to as “color leaking” (Radiosity example).
In closed environments, light energy is generated by “emitters” and is accounted for by reflection or absorption of the surfaces in the environment. The rate at which energy leaves a surface is called the “radiosity” of a surface. Unlike conventional rendering methods, radiosity methods first calculate all light interactions in an environment in a view-independent way. Then, different views can be rendered in real-time. In Blender, since version 2.28, radiosity is both a rendering and a modeling tool. This means that you can enable radiosity within a rendering or rather use radiosity to paint vertex colors and vertex lights of your meshes, for later use.
Normal directions are crucial
The light emission is governed by the direction of the normals of a mesh. This is of course crucial for emitters, but also for all meshes, as when they re-irradiate their unshot energy, they do it in their normal direction.
|
Technical Details
During the late eighties and early nineties, radiosity was a hot topic in 3D computer graphics. Many different methods were developed, the most successful of these solutions were based on the “progressive refinement” method with an “adaptive subdivision” scheme. And this is what Blender uses. To be able to get the most out of the Blender radiosity method, it is important to understand the following principles:
- Finite Element Method
- Many computer graphics or simulation methods assume a simplification of reality with “finite elements”. For a visually attractive (and even scientifically proved) solution, it is not always necessary to dive into a molecular level of detail. Instead, you can reduce your problem to a finite number of representative and well-described elements. It is a common fact that such systems quickly converge into a stable and reliable solution. The radiosity method is a typical example of a finite element method inasmuch as every face is considered a “finite element” and its light emission considered as a whole.
- Patches and Elements
- In the radiosity universe, we distinguish between two types of 3D faces:
- Patches
- These are triangles or squares which are able to send energy. For a fast solution it is important to have as few of these patches as possible. But, to speed things up the energy is modeled as if it were radiated by the patch’s center; the size of the patches should then be small enough to make this a realistic energy distribution. (For example, when a small object is located above the patch center, all energy the patch sends is obscured by this object, even if the patch is larger! This patch should be subdivided in smaller patches).
- Elements
- These are the triangles or squares which receive energy. Each Element is associated with a Patch. In fact, patches are subdivided into many small elements. When an element receives energy it absorbs part of it (depending on its color) and passes the remainder to the patch, for further radiation. Since the elements are also the faces that we display, it is important to have them as small as possible, to express subtle shadow boundaries and light gradients.
- Progressive Refinement
- This method starts with examining all available patches. The one with the most “unshot” energy is selected to shoot all its energy to the environment. The elements in the environment receive this energy, and add part of it to the “unshot” energy of their associated patches (the remaining being absorbed). Then the process starts again for the patch now having the most unshot energy. This continues for all the patches until no energy is received anymore, or until the “unshot” energy has converged below a certain value.
- The hemicube method
- The calculation of how much energy each patch gives to an element is done through the use of “hemicubes”. Exactly located at the patch’s center, a hemicube (literally, “half a cube”) consist of five small images of the environment. For each pixel in these images, a certain visible element is color-coded, and the transmitted amount of energy can be calculated. Especially with the use of specialized hardware, the hemicube method can be accelerated significantly. In Blender, however, hemicube calculations are done “in software”. This method is in fact a simplification and optimization of the “real” radiosity formula (form factor differentiation). For this reason, the resolution of the hemicube (the number of pixels of its images) is approximated, and its careful setting is important to prevent aliasing artifacts.
- Adaptive subdivision
- Since the size of the Patches and Elements in a mesh defines the quality of the radiosity solution, automatic subdivision schemes have been developed to define the optimal size of patches and elements. Blender has two automatic subdivision methods:
- 1. Subdivide-shoot Patches
- By shooting energy to the environment, and comparing the hemicube values with the actual mathematical “form factor” value, errors can be detected that indicate a need for further subdivision of the patch. The results are smaller patches and a longer solving time, but a higher realism of the solution.
- 2. Subdivide-shoot Elements
- By shooting energy to the environment, and detecting high energy changes (gradients) inside a patch, the elements of this patch are subdivided one extra level. The results are smaller elements and a longer solving time and maybe more aliasing, but a higher level of detail.
- Display and Post Processing
- Subdividing elements in Blender is “balanced”, that means each element differs a maximum of one subdivide level with its neighbors. This is important for a pleasant and correct display of the radiosity solution with Gouraud shaded faces. Usually, after solving, the solution consists of thousands of small elements. By filtering these and removing “doubles”, the number of elements can be reduced significantly without destroying the quality of the radiosity solution. Blender stores the energy values in “floating point” values. This makes settings for dramatic lighting situations possible, by changing the standard multiplying and gamma values (this is the same principle as HDR with modern GPUs).
- Radiosity for Modeling
- The final step can be replacing the input meshes with the radiosity solution (button Replace Meshes, Radio Tool panel, Radiosity sub-context, Shading context, F5). At that moment the vertex colors are converted from a “floating point” value to a 24 bits RGB value. The old mesh objects are deleted and replaced with one or more new mesh objects. You can then delete the radiosity data with Free Data. The new objects get a default material that allows immediate rendering. Two settings in a material are important for working with vertex colors (both in Material panel, Material sub-context):
- VCol Paint
- This option treats vertex colors as a replacement for the normal RGB value in the material. You have to add lamps in order to see the radiosity colors. In fact, you can use Blender lighting and shadowing as usual, and still have a neat radiosity “look” in the rendering.
- VCol Light
- The vertex colors are added to the light when rendering. Even without Lamps, you can see the result. With this option, the vertex colors are pre-multiplied by the material RGB color. This allows fine-tuning of the amount of “radiosity light” in the final rendering.
