Wednesday, October 7, 2009

Radiosity Rendering

Download the blend file



Hi. Conventional lighting systems use lamps and cameras. The light is emitted from the lamps, bounces off the object, and then interacts with the camera to determine how the object is lit. The object is basically a passive receiver of light.

Radiosity takes a different approach. No lamps are necessary, although radiosity can be used to supplement traditional lamp based lighting. Instead, the objects themselves, or at least the ones you designate as light emitters, are the light source. They also receive light, but this time from other objects. This occurs in real life, and it's not limited to lamps. Think of lit matches, fire, glowing embers, or atomic bombs. Radiosity is a mathematical calculation of how objects that emit light interact with objects that receive light. Most objects actually do both at the same time. Radiosity rendering can produce stunning effects, but it takes getting used to. The goal of this tutorial is just to make you comfortable with radiosity setup.

Start by deleting the lamp. Radiosity does not need the lamp because the light comes from the materials applied to the objects. Right click on the lamp, and press X to confirm the delete.

Add a UV Sphere to the scene, with Space-Add-Mesh-UVSphere. We'll give the UVSphere 16 segments and 16 rings. The top half of the UV Sphere will be our light source, acting somewhat like a hemi lamp, with a soft hemispheric lighting effect and soft shadows. Move the UVSphere so that it is above the cube. Grab it, with the G key, and move it up. Scale the UVSphere 5 times - S 5 then ENTER. Press Z to go into wireframe mode and Tab to go into Edit mode.

We need to delete the bottom half. Press the A key to deselect the vertices. Then box select (B key) all the bottom vertices. Press the X key to delete the selected faces on the bottom half. We're left with a hemisphere.

Press F5 for the Shading buttons, and click on the Material button. Click Add New to add a material. Give the cube R, G, and B values each of .5, so that the hemisphere will emit equal amounts of each. Click on the Shaders panel, and set the Emit value to .02. It's a small number, but the UVSphere has many faces which will generate sufficient light for the scene.

We need to make sure that the normals are pointing towards the cube. Light is emitted from the face normals. Press F9 to go to the Edit buttons. In the Mesh Tools More panel, click on Draw Normals. Set NSize to 1.0. Select all the vertices by pressing the A key. Note that the normals are outside, so the light will not reach the cube. To fix this, press the W key and select Flip Normals to have the face normals point inward.

Before we continue, we need to make sure radiosity is enabled in our render. Press F10 for the Scene buttons, turn on Radiosity, and turn off SS, Ray, Shadow, and Envmap. The entire scene will be lit by the UVSphere radiosity.

Let's set the camera as well. Set the scene so that the UVSphere is providing hemispherical light to the cube, which is a bit off of the plane. Move the hemisphere up a bit, out of the camera view. Move the camera in a bit towards the cube.

Now we'll create a white ground plane from which the shadows will fall. Tab out of Edit mode. Add a plane - Space-Add-Mesh-Plane, and scale it 5 times - S 5 Enter. Grab it and move it below the cube with some space between the bottom of the cube and the plane.

Press the Shading button (F5) and add a new material by clicking the Add New button. Make the plane white by setting the R, G, and B sliders all the way to 1. We need to make sure that the normals are facing upward. Tab into Edit mode. In the Editing Context, Mesh Tools More panel, click Draw Normals and set Normal Size to 1. The normals point downward. They need to point upward. Press the W key and select Flip Normals to fix this.

Tab out of Edit mode. Select the cube, Shift F2. Click the Shading button, F5. Set the material color to Blue, R=0, G=0, B=1. Tab into Edit Mode. We need to check the normals. From the Mesh Tools More panel, click Draw Normals and Set Normal Size to 1. Indeed, the normals face outside, which is correct. Tab out of Edit mode.

Now we're ready for our first radiosity render. Tab out of edit mode. Press the Radioactive icon, for radiosity. Before we start the calculation, press the Gour button, which is a good choice for radiosity with shadows. Shift-Select the cube, the plane, and the UV Sphere: every object in the scene except the camera. All of these will participate in the radiosity calculation. In the Radio Tools panel, click the Collect Meshes button. Now we're ready for the calculation. Click the big GO button for the radiosity calculation. I'll pause the video while the radiosity calculation does its thing. See you when it's done. Press F12 to render.

Next, we'll add a yellow monkey next to the cube. First, press the Free Radio Data button to clear the radiosity calculations. We are going to recalculate te radiosity after we add the monkey. Press Space, Add, Mesh, Monkey. Click the Shading Buttons, F5. Add a yellow material, by clicking the Add New, and setting Red to 1, Green=1, and Blue to 0. Note that Ambient is .5, which means that the monkey can receive 1/2 of the light sent to it from the UVSphere. Emit is 0. The monkey is only receiving light, not emitting it. Tab into Edit mode. Press F9 for the Edit windows. Note that the face normals are pointing outward, to receive the light, so we're fine.

Tab into object mode. Smooth the monkey by pressing the Set Smooth button. Then add a Subsurf modifier at Level 2.

Press F12 to render. I'll pause the video again until it's done.

This just scratches the surface. You get more realistic rendering if you work with more geometry. Experiment with the different settings that influence the radiosity calculation. You may want more defined shadows or a different color mix. You can also mix radiosity with other non-lamp lighting effects, such as ambient occlusion. Happy Blending!