Manual/PartXII/Radiosity Rendering

Wikipedia,自由的百科全书

User Manual: Contents | Guidelines | Blender Version 2.31

Contents

Radiosity Rendering

The Blender Radiosity method

Blender光能传递方法

First, some theory! You can skip to the next section if you like, and come back here if questions arise. 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:

首先,介绍一些原理。如果你喜欢的话可以略过去看下一节,如果遇到了什么问题可以再返回来看。在80年代末90年代除,光能传递是3D电脑图形的一个热门话题。那个时期发明了很多各种不同的算法,最成功的要算采用自适应细分逐步细化的方案了。这也是blender采用的方法。想要得到最好的blender的光能传递的解决方法,理解下面的原理很重要。


  • 'Finite Element Method
Many computer graphics or simulation methods assume a simplification of reality with 'finite elements'. For a visually attractive (and even scientifically proven) 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 modelled as if it were radiated by the Patch's centre; 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 centre, 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 colour) 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.
  • 面片&元素
在光能传递领域,我们着重这两种3D面
面片
三角形&四边型的作为发射能量的。要想快速的计算必须尽可能减少面片。然而为了加快速度能量由面片的中心发射;面片的大小应该有足够的小才能表达真实的能量分布,(例如一个小的物体位于面片的中心,即使这个面片非常的巨大面片所发出的所有的能量将被这个物体影响变暗,这个面片应该细分的足够的小才可以。)


元素
三角形或者四边形的作为接受能量。每个元素关联一个面片。事实上面片被细分为很多小的源。当一个源接受到能量以后它吸收能量的一部分(取决于源的颜色)并且发射传递剩余给面片,作为进一步的发射。源也作为面片显示,为了表达精细的阴影&灯光衰减把源细分的更小非常重要。


  • Progressive Refinement
This method starts with examining all available Patches. The Patch 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 this to the 'unshot' energy of their associated Patches. 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 5 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 optimisation of the 'real' Radiosity formula (form factor differentiation). For this reason the resolution of the hemicube (the number of pixels of its images) is approximate and its careful setting is important to prevent aliasing artefacts.


  • 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 '1' subdivide level with its neighbours. 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.
  • Radiosity for Modelling
The final step can be replacing the input Meshes with the Radiosity solution (button Replace Meshes). At that moment the vertex colours 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 colours:
VColPaint.
This option treats vertex colours as a replacement for the normal RGB value in the Material. You have to add Lamps in order to see the Radiosity colours. In fact, you can use Blender lighting and shadowing as usual, and still have a neat Radiosity 'look' in the rendering.
VColLight.
The vertexcolors are added to the light when rendering. Even without Lamps, you can see the result. With this option, the vertex colours are pre-multiplied by the Material RGB colour. This allows fine-tuning of the amount of 'Radiosity light' in the final rendering. As with everything in Blender, Radiosity settings are stored in a datablock. It is attached to a Scene, and each Scene in Blender can have a different Radiosity 'block'. Use this facility to divide complex environments into Scenes with independent Radiosity solvers.

Radiosity Rendering

光能传递渲染

Let's assume you have a scene ready, and that you want to render it with the Radiosity Rendering. The first thing to grasp when doing Radiosity is that no Lamps are necessary, but some meshes with an Emit material property greater than zero are required, since these will be the light sources. You can build the test scene shown in BSG.RAD.F.S68.101, it is rather easy. Just make a big cube for the room, give different materials to the side walls, add a cube and a stretched cube within it, and add a plane with a non-zero Emit value next to the roof, to simulate the area light (Set-up for Radiosity test.). You assign Materials as usual to the input models. The RGB value of the Material defines the Patch colour. The 'Emit' value of a Material defines if a Patch is loaded with energy at the start of the Radiosity simulation. The 'Emit' value is multiplied with the area of a Patch to calculate the initial amount of unshot energy.

Emitting faces: Check the number of 'emitters' on Blender console! If this is zero nothing interesting can happen. You need at least one emitting patch to have light and hence a solution.
Set-up for Radiosity test.
Set-up for Radiosity test.

When assigning materials be sure that all of them have the Radio toggle on to enable the Shader Panel of the Material subcontext buttons (Radiosity enabled material.).

Radiosity enabled material.
Radiosity enabled material.

Please note that the light emission is governed by the direction of the normals of a mesh, so the light emitting plane should have a downward pointing normal and the outer cube (the room) should have the normals pointing inside, (flip them!). Switch to the Radiosity Image:Manual-Part-XII-RadButton.png sub-context of the Shading Context. The Panels, shown in Radiosity buttons for radiosity rendering., are two: Radio Rendering which governs Radiosity when used as a rendering tool (present case) and Radio Tool, which governs Radiosity as a modelling tool (next section).

Radiosity buttons for radiosity rendering.
Radiosity buttons for radiosity rendering.

The buttons define:

  • Hemires: - The hemicube resolution; the color-coded images used to find the Elements that are visible from a 'shoot Patch', and thus receive energy. Hemicubes are not stored, but are recalculated each time for every Patch that shoots energy. The 'Hemires' value determines the Radiosity quality and adds significantly to the solving time.
  • Max Iterations: - The maximum number of Radiosity iterations. If set to zero Radiosity will go on until the convergence criterion is met. You are strongly advised to set this to some non-zero number, usually greater than 100.
  • Mult:, Gamma: - The colourspace of the Radiosity solution is far more detailed than can be expressed with simple 24 bit RGB values. When Elements are converted to faces, their energy values are converted to an RGB colour using the Mult and Gamma values. With the Mult value you can multiply the energy value, with Gamma you can change the contrast of the energy values.
  • Convergence: - When the amount of unshot energy in an environment is lower than this value, the Radiosity solving stops. The initial unshot energy in an environment is multiplied by the area of the Patches. During each iteration, some of the energy is absorbed, or disappears when the environment is not a closed volume. In Blender's standard coordinate system a typical emitter (as in the example files) has a relatively small area. The convergence value is divided by a factor of 1000 before testing for that reason.

Set the Max Iterations: to 100 and turn to the Scene Context and Render Sub-context (F10). Locate the Radio Tog Button (Enabling Radiosity in the Rendering Buttons.) in the Render Panel and set it 'on' to enable Radiosity, then Render! (F12).

Enabling Radiosity in the Rendering Buttons.
Enabling Radiosity in the Rendering Buttons.

The rendering will take more time than usual, in the console you will notice a counter going up. The result will be quite poor (Radiosity rendering for coarse meshes (left) and fine meshes (right)., left) because the automatic radiosity render does not do adaptive refinement! Select all meshes, one after the other, and in EditMode subdivide them at least three times. The room, which is much bigger than the other meshes, you can even subdivide four times. Set the Max Iterations a bit higher, 300 or more. Try Rendering again (F12). This time the rendering will take even longer but the results will be much nicer, with soft shadows and colour leakage (Radiosity rendering for coarse meshes (left) and fine meshes (right)., right).

Radiosity rendering for coarse meshes (left) and fine meshes (right).
Radiosity rendering for coarse meshes (left) and fine meshes (right).
Note: In the Radiosity Rendering Blender acts as for a normal rendering, this means that textures, Curves, Surfaces and even Dupliframed Objects are handled correctly.
Previous: Manual/PartXII Contents Next: Manual/PartXII/Radiosity as a Modelling Tool
Personal tools