From BlenderWiki

Jump to: navigation, search

Introduction

Many people like to show their models without texture and few lights, falling back to Ambient Occlusion (AO) as main lighting of the model. If you like the grain look, no problem, but if you want a smooth look, it would be nice if there was a way that renders faster and that we can assemble quickly or import from our libraries. To follow this trick, you should download the AO with spots file, and examine it, as the following text is the description of its creation. You can find another article in the manual about this Fake Global Illumination method, but here we will do a comparision, trying to match the same look and checking the speed differences.

Procedure

Here is where the old trick comes into play. The explanation is rather simple, instead of the raytracing done with AO, use a lot of low intensity buffer based spot lamps. The price to pay is memory usage, as it will need to store all the shadow buffers. So it decreases the CPU usage but increases memory usage, which should be no problem if you have plenty.

Our sample scene is going to be a simple plane to make the ground, and a monkey head as main subject. We will use a ray casting lamp as main source, like the Sun. As is, it looks rather dark. We will do a revision, adding a Hemi light without shadows, that will work as light bounced by the sky and other surroundings. That will be our base image.

One base light with shadows
Base light plus hemi light

Hide the Hemi light by sending it to another layer with M. We will test other methods to compensate for the lack of this light, first AO. Enable Ambient Occlusion in the World material via F8, leaving all default except changing the mode to Both and render F12.

Ambient occlusion with default values except mode set to Both, view the full size versionto notice the problem..

Comparing results

Remember you can compare two images in the render window with J. In 2.42 and newer you can use Image Area and rename previous renders to a temporary name, but flipping from one to another image is slower, sadly.

The Ambient Occlusion defaults gives a rather noisy result, but clearly shows what is in the open versus what is near lots of things. If you raise the samples, you will get a smoother result, maybe still grainy. But what is certain is that the render time will increase a lot. Remember that the value in the Samples button is really used to calculate "Samples * Samples" each time. So now try setting the value to 12, thus making the computer do 144 rays instead of the 25 with the default button value of 5.

Ambient Occlusion with default values except mode set to Both and Samples to 12, view the full size versionto notice the problem.

Now that is way better, still some grain, but not so visible as the first time. Time has gone up in a noticeable way. So let's move to the heart of the proposed technique, disabling ambient occlusion.

Add an Icosphere with default value of 2. That way we have 42 points forming a sphere. Before going out of edit mode recalculate the normals inside with ⇧ ShiftCtrlN. Scale it to 20 times the original size, with S and Ctrl or N panel.

Now add a Spot lamp in the same place as the sphere, and set its ranges ClipSta 10 and ClipEnd 30, the angle SpotSi to 60, the ShadowBufferSize to 1024 and the Energy to 0.075 . Select the lamp then the Icosphere and parent with CtrlP. Go to F7 and enable Dupliverts and Rot; with the Icosphere as active object, of course. The ranges and angle of the lamp are those so the duplicated lamps cover the subjects we want to light, so you will probably need to adjust in your own scenes. Do not try to adjust to the minimum, best leave a bit of room.

Spot based AO.

The result is a complex draw of many lights, clobbering your view. While working, the best is to have the sphere and lamp into a different layer that you only activate for renders. One final piece of advice, move the sphere up a bit, so no lamp hits the plane completely perpendicular as that could generate a nasty looking surface due to computation errors.



How to Tune the Lamps

You have followed the steps above, but you should be also capable of deciding your own values. First sphere related issues. You may like to try with level 3 Icosphere. You can also try by removing half or some part of the bottom half. Another thing to try is using UVSphere, in full or after removing some parts.

What we do gain with those changes? More lamps means smoother results, but also higher memory usage. Removing parts of the sphere allows you to focus the light from some part and even save memory if you know a lamp is not going to contribute. The UVSphere also gives a layout with two concentrations of lights that you can use to affect the distribution of light too. Remember you can rotate the sphere to control the light distribution.

A quick way to check what sizes to use for the lamp is, before parenting, manually place the light more or less where a vertex is, for example the top one and use the side view. Adjust SpotSi, ClipSta and ClipEnd then move back to center of the sphere with this quick sequence: select sphere, snap cursor to selection with ⇧ ShiftS then 4, select lamp, snap selection to cursor ⇧ ShiftS then 2.

For the Energy, I started with AO image of Samples 5 loaded in the extra buffer you get with J and the lamps set to 1/42 = 0.023... which I rounded to 0.025. The comparision revelead that it was too dark, so raised to 0.05, and that was still dark, so tried with 0.075.

Soft number button started with default value, and after seeing some big areas in the ground that were not mixing correctly, I raised the value to 6, and again to 9 as it still was a bit obvious.

Remember we are cheating, so you have to go with what looks ok, not with the numbers one would think as valid. Once you know how it works, you can decide in which other cases it is useful and what values or sphere to use. Try with different objects, not only spheres.

Time Comparision

Lets see a quick table of the results, taking the plain light plus hemi light as the base value and seeing how many times the other scenes took place, approximately.

Light setup Relative time
Plain 0.95
Plain plus Hemi 1
Plain plus AO (defaults with Both) 4
Plain plus Spot lights 4
Plain plus AO (defaults with Both and Samples 10) 12
Plain plus AO (defaults with Both and Samples 12) 18

We required more time than the normal setup for this trick, as much as with grainy Ambient Occlusion but the result was even better than the one with lots of Samples. It is a good balance.