Blender 2.7 Basics — Tutorial 05: Lighting

Point Lamp

Lighting is not just for illuminating the scene but it can also set the mood and drama of the scene.

If we select the Lamp in the default scene and go into the Lamp panel in the Properties Editor we see that we have five Lamp options: Point, Sun, Spot, Hemi, and Area. We also have a preview that will show us what our Lamp will look like in the scene.

Let’s start off by looking at a very basic light called the Point Lamp. If we now go into Texture Mode we can see the affect that the lamp is having on the Cube. As we move the Point Lamp up and down we can see how the Point Lamp’s falloff affects the lighting on the Cube.

The Point Lamp is similar to a bare lightbulb in a room in that it generates energy in all directions. If we move the Point Lamp above the Cube we notice that there is no shading on the sides of the Cube. If we then move the Point Lamp behind the Cube angled from one corner we notice that we get different shading over the Cube.

If we go to the Render tab and quickly render the scene we notice that we do not have a tremendous amount of light in the scene. If we go back to the Lamp panel we notice that the Falloff option is set to Inverse Square (the default). Inverse Square is natural lighting which means that the light falls off with the square of distance from the object — the Cube in this example. This means that things get dimmer the further they are from the light.

If we change the Falloff to Constant however we can see there will be no Falloff and everything will be illuminated evenly. If we quickly render the scene notice that the top and side closest to the Point Lamp are now evenly illuminated.

Let’s look at the other options available to us.

We can change the color of the light using the light picker. If we change the color to a bright yellow we can now see that the Cube has a yellow color highlight added to it from the Point Lamp. If we want to add a second color using the Point Lamp we simply add a second Point Lamp using the shortcut SHIFT + A > LAMP > POINT. We then move the second Point Lamp to the front corner of the Cube and change the Falloff to Constant and the color to red.

Let’s delete this second Point Lamp by selecting it and then using the shortcut X and delete.

Select the remaining Point Lamp and go back to the Lamp panel.

The Energy variable makes the light brighter or dimmer in the scene. If we change the Energy variable to 3 we notice how much brighter the light has become in the scene. If we change it back to 1 we notice how much dimmer the light has become in the scene.

Negative Light basically allows us to subtract light from the scene. This is useful if we have too much light in the scene. Specular and Diffuse allows us to add specular and diffuse channels to the light. Diffuse is useful when we want to have a more flat looking scene and Specular is useful for adding highlights to the scene.

We’ve already looked at the Inverse Square and Constant Falloff options. Inverse Linear is basically a straight-line falloff option. Inverse Coefficients combine the Inverse Square, Inverse Linear, and Constant options into a single formula. Custom Curve allows us to have the light fall off however we want it to. The Weighted option Falloff type allows the mixing of the two light attenuation profiles (linear and quadratic attenuation types) and is more of a custom option.

The Distance option is controlling where the light is falling — at a linear rate by default — to half its original value from the light’s origin. If we put a checkmark next to “Sphere” and using the MMB to zoom out we see a circle enclosing our scene.

The Sphere option restricts the light illumination range of a Point Lamp, so that it will completely stop illuminating an area once it reaches the number of Blender Units away from the Lamp, as specified in the Distance field. If we change the Distance to 5 we can now see that the Sphere is much smaller which means that the illumination range is now much smaller and (zooming in) we see that the scene is much darker.

Ray-Traced Shadows

Let’s go into Orthographic Mode (5 on the Numpad) and Front View (1 on the Numpad). Let’s add a Plane to the scene (SHIFT + A > MESH > PLANE) and place it at the bottom of the Cube. We can now size the Plane up using S and the number 4.

Now let’s select the Point Lamp and go back to the Lamp panel. Make sure the Falloff is changed to Constant and the Distance is 30.

In the real world lights cast Shadows but in Blender we can turn Shadows on and off. Let’s take a look at the Ray Shadow option in Blender.

If we check No Shadow under the Shadow option and do a quick render we see that we have no shadow. This doesn’t look natural at all. However, if we choose Ray Shadow and do a quick render of our scene we notice that we have a shadow of the Cube onto the Plane. This Shadow is very dark and has hard edges but there are ways of changing this style of Shadow.

We could add more light to the scene but an easy way of changing the look of the Shadow is to simply change its color. If we click on the Color Picker and change the color to a dark gray instead of black and do a quick render we notice that the shadow is now much lighter in color. This makes the Shadow look much closer to real life. We can of course make this any color we want which can be useful if we have something that it semi-transparent and we need to match a red object for example.

This Shadow has a very hard, crisp edge but there may be times when we need a softer, fuzzier edge to the Shadow. We can make this happen by using the Sampling and Soft Size options. If we change the Samples to 8 and the Soft Size to 2 and do a quick render we notice that the Shadow is not softer and has fuzzy edges

Creating Sunlight

Now let’s look at the Sun Lamp. This Lamp type creates a good approximation of the sky and we can also add in sky as well.

Let’s start with a clean scene by going to File > New > Reload Startup File. Make sure the Lamp is selected in the scene and change the Lamp option to Sun. The Sun Lamp works basically the same as a Hemi Lamp since it is directional and not positional. In other words, the only thing that really matters is the direction of the Lamp and not the position of the Lamp.

If we go into Texture Mode we see that the angle that the Sun Lamp is currently located only illuminates the top and side of the Cube but if we rotate the Lamp (using the R key) we can change the parts of the Cube that are illuminated. Go into Top View (7 on the Numpad) and then hit R and rotate the Lamp so it is pointed toward the Camera. Now if we render the scene we notice that the top is still illuminated but the side is no longer illuminated.

The biggest difference between the Sun Lamp and the Hemi Lamp is that we can produce Shadows using the Sun Lamp. We can see that in the Lamp panel we have an option for No Shadow and Ray Shadow just like we had under the Point Lamp options.

The Adaptive QMC option calculates Shadow values in a less uniform and distributed way. This is useful in making quick renders. The Constant QMC option calculates Shadow values in a very uniform and evenly distributed way. This option results in more accurate Shadows. Threshold is used for adaptive sampling and is used to determine if the Adaptive QMC shadow sample calculation can be skipped based on a threshold of how shadowed an area is already.

The Sky and Atmosphere controls allow the light to create an artificial sky as well as an artificial sun. Let’s place a checkmark next to “Sky” to turn on these options.

If we now render this scene we notice that instead of the default gray background we now have a default Sky. Under the Render Presets we have Classic, Desert, and Mountain presets. The only difference between these presets is the settings that reflect each individual preset.

Let’s choose the Mountain Sky preset and render the scene. Notice that the default Sky color is now a darker blue gradient. However, when we render the scene we notice that we cannot see the sun visible in the Sky. This is because the sun is not actually facing the Camera.

Go into Top View (7 on the Numpad). Select the Camera and open up the Properties Region Panel (N). Let’s change the Location to 0 for all the axes. Then move the Camera along the Y-Axis until it is at location -4. Then hit R and Z and rotate the Camera so it is facing the Cube. Then change the Z location to 3.

Now select the Sun Lamp and change its location to all zeroes. Then change the Y-Axis location to 3 and the Z-Axis location to 3.5. Change the Z Rotation to 180 so it is now facing the Camera. When we go into Camera View (0 on the Numpad) and into Rendered View we can now see the location of the Sun.

Turbidity is a general parameter that affects sun view, sky and atmosphere; it is an atmosphere parameter where low values describe clear sky and high values shows more foggy sky. If we change this value to 10 we can now see a foggy appearance in the Rendered View.

The Blending option blends the Sun Lamp with the background as defined in the World tab. If we change the Factor to 0 we get the default gray background and if we change it back to 1.0 we get the full sun effect. We also have Blending options just like we see in other software like Photoshop.

We have the option of changing the brightness of the Horizon and its Spread. Brightness controls brightness of colors at the horizon. If we change the Brightness to 1we see that the light is now much brighter and turns much more yellow and orange. If we change it back to 0.1 we see a much bluer sky. Spread controls the spread of light at the horizon. If we change the Spread to 8.0 we see a larger spread of light at horizon.

The Color Space allows us to select which color space the effect uses and the Exposure allows us to modify the exposure of the rendered Sky and Sun.

The Sun Brightness option controls the brightness of the sun. If we change the Brightness to 5.0 we see a much brighter sun effect. If we change it back to 2.0 we get a dimmer sun effect. The Sun Size option controls the size of the sun. If we change the Size to 8.0 we notice that the sun becomes smaller but when we change it back to 4.0 the sun becomes larger. The Sun Back Light option changes the sun’s color and light around the sun. If we change the value to 1.0 we see a color change to a more pink color and there is more light around the sun but if we change the value back to -1.0 we see a more yellow sky and less light.

The Atmosphere option is basically a way of making a fog effect for the render. It tries to simulate the effects of an atmosphere, that is, scattering of the sunlight in the atmosphere Place a checkmark next to Atmosphere to turn on the option.

Intensity sets the intensity of the sun. If we change the Intensity to 2.0 we notice that the sky is less blue but when we change it back to 10 we notice a bluer and more intense light. Distance changes the yellow light in the scene. If we change the Distance to 10 we get a much more yellow light than we did with the Distance set at 1.0.

Inscattering effects the light inscattered into the atmosphere between the camera and the objects in the scene. Extinction is used to decrease the effect of extinction light from object in the scene.

Spot Lamps

Now let’s look at the Spot Lamp. This Lamp type allows us to confine light to a very specific beam of light.

Let’s start with a clean scene by going to File > New > Reload Startup File. Make sure the Lamp is selected in the scene and change the Lamp option to Spot.

The Spot Lamp allows us to confine light to a very specific beam of light within the scene which is similar to a spotlight in a theater or a flashlight. Notice that there is a cone of light that we can work with when we are using this type of Lamp.

Let’s go into Texture Mode so we can see how this Lamp works. If we move the Lamp up and down we get a change in the falloff of the light onto the Cube. If we move the Lamp along the X-Axis we can see how the light interacts with the Cube. If you look under the Lamp options you will notice that we have the same options that we had under the Point Lamp. For now, let’s just change the Falloff to Constant.

Let’s go into Orthographic Mode (5 on the Numpad) and Front View (1 on the Numpad). Let’s add a Plane to the scene (SHIFT + A > MESH > PLANE) and place it at the bottom of the Cube. We can now size the Plane up using S and the number 4.

Select the Lamp and go back to the Lamp panel. Let’s do a quick render and take a look at how this Lamp is illuminating the Cube and Plane

We also see that we have Shadow options similar to the Point Lamp and the Sun Lamp. In addition we have a Buffer Shadow option which we will explore momentarily.

We can manipulate the Lamp even further under the Spot Shape option. If we want to make the cone smaller and illuminate a smaller area we can use the Size option. Let’s go into Rendered View and change the Size to 25. Now we see that the Lamp is illuminating a much smaller area than when the Size was set to 75.

The Blend option controls the sharpness of the edge of the light. If we change the Blend to 0.75 we see that the edge has now become much softer than when it was set to 0.15. If we check Square it changes this edge from a rounded vignette-type edge to a square edge.

If we go into Texture Mode and turn on Show Cone we can now see where the light is falling. This helps when trying to set up the Lamp to illuminate certain sections of the scene. If we go back into Rendered View and turn on Halo we can actually see the beam of light. We can also change the Intensity of this light using the Intensity option. If we change the Intensity to 0.3 we see a much lesser intensity to the light than when it was at 1.0.

Buffer Shadows

Let’s turn off Halo, Show Cone, and Square and change the Shadow option to Buffer Shadow. Buffer Shadows are actually created using a bitmap rather than Ray Tracing so they render much more quickly.

The first option is the color of the shadow. Let’s change the color to a lighter gray.

The next option — Buffer Type — controls the way the Shadows are buffered. There are four options: Classical, Classic-Halfway, Irregular, and Deep.

The Classical Buffer Type is an older way of generating Buffered Shadows which isn’t very accurate and is really only used for backward-compatibility with older versions of Blender.

The Classic-Halfway Buffer Type is an improved Buffered Shadow method and is the default option. It works by averaging the first and second nearest Z-depth values.

The Box Filter Type is used for low resolution renders and provides anti-aliased Shadows. It is often useful for images which have sharply angled elements and horizontal/vertical lines. The Tent Filter Type is used as a general purpose filtering method that provides anti-aliasing. This Filter takes into account the sample values of neighboring pixels when calculating its final filtering value. Gauss produces a soft, blurry anti-aliasing option. It is excellent with high resolution renders.

The Soft option indicates how wide an area is sampled when performing anti-aliasing on the Buffered Shadows. If we change the value to 10 we see how much softer the edges of the Shadow are as opposed to when the value was set to 3.0. Bias helps with Shadow accuracy.

The Sample Buffers value can be set to represent the number of shadow buffers that will be used when doing anti-aliasing on Buffered Shadows. This option is used in special cases, like very small objects which move and need to generate really small shadows. The Size represents the resolution used to create a shadow map and Samples control the number of samples taken per pixel when calculating shadow maps.

Clip Start indicates the point after which Buffered Shadows can be present within the Spot Lamp area. Clip End indicates the point after which Buffered Shadows will not be generated within the Spot light area. The area between Clip Start and Clip End will be capable of having buffered shadows generated. As well as manually setting Clip Start and Clip End fields to control when buffered shadows start and end, it is also possible to have Blender pick the best value independently for each Clip Start and Clip End field.

The Irregular Buffer Type is used to generate sharp, hard Shadows that are placed as accurately as Ray Trace Shadows. This method also supports transparent Shadows. The Bias adds a slight offset distance between an object and the Shadows cast by it. If we zoom in and change the Bias to 5.0 we can notice a shift in the Shadow at the front-right corner of the Cube.

The Clip Start and Clip End work the same as the Classic-Halfway Buffer Type.

The Deep Buffer Type has options similar to the Classic-Halfway Buffer Type but it offers better filtering and supports transparency. Compress sets the threshold for the map compression and it gives you more bit depth in the shadow area so that way you can get more image in that shadow.

Hemi Lamps

Now let’s look at the Hemi Lamp. This Lamp creates directional light and basically creates an infinite hemisphere which projects light.

Let’s start with a clean scene by going to File > New > Reload Startup File. Make sure the Lamp is selected in the scene and change the Lamp option to Hemi.

The Hemi Lamp is similar to a spotlight in that the light is directional but it doesn’t have a specific source so it doesn’t create a cone such as a spotlight. This Lamp type doesn’t have a lot of options available. We can change the color like we can with the other Lamps and we can change the Energy. We also see the Negative, Specular, and Diffuse options.

The Hemi Lamp does not cast shadows but it does have direction. The Lamp’s direction is over the Cube so if we do a quick render we see that the Cube is illuminated with a general light from above the Cube. It is important to remember that the light originates from infinity so the location of the Hemi Lamp isn’t important — only the direction. If we move the Lamp along the Z-Axis so it is below the Cube and then render the scene we still get an overall light. This is because the Lamp is still facing in the same direction even though its location is different.

Since the Hemi Lamp produces no shadows this Lamp is useful for a nice general illumination of the scene.

Area Lamps

Now let’s look at the Area Lamp. This Lamp provides light from a specific region, rather than a point or a source.

Let’s start with a clean scene by going to File > New > Reload Startup File. Make sure the Lamp is selected in the scene and change the Lamp option to Area.

If we zoom into the Lamp we notice that it is a square and this is where the light is originating. We are projecting light from the square which acts similar to a soft box or a window.

Similar to the other Lamps we have a Color option as well as Energy and Distance options and Negative, Specular, and Diffuse options. In addition, we have a Gamma option which controls the contrast and falloff. The Area Lamp doesn’t have Falloff settings so the only way to control Falloff is to use the Distance and Gamma options.

If we go into Rendered View we notice that the light is very bright and blows out the scene. We have two options for changing the lighting. We can move the Lamp or we can change the Distance value. If we go back into Solid View we notice a dotted line extending out from the Lamp. This is the Distance of the Lamp. If we change the Distance from 30 to 5.0 we notice that the dotted line is now shorter and if we go into Rendered View we notice that the lighting has changed significantly.

Let’s go back into Solid View and look at the Area Shape. If we zoom into the Lamp we notice that there is a square that is producing the light. We can change the size or shape of the Lamp under the Area Shape options. Let’s change the Size X to 0.5 and leave Rectangle selected. We now see a rectangle producing the light. If we now change to Square we have a square producing the light. This really doesn’t have an effect on the shape of the light. However, if we combine this option with Shadows we can make changes to the scene.

Let’s change the Size back to 0.1 and zoom back out so we can see the Cube.

Let’s go into Orthographic Mode (5 on the Numpad) and Front View (1 on the Numpad). Let’s add a Plane to the scene (SHIFT + A > MESH > PLANE) and place it at the bottom of the Cube. We can now size the Plane up using S and the number 4.

Make sure the Lamp is selected and make sure Ray Shadow is selected in the Lamp panel. First, let’s change the color to a light gray and go into Rendered View. Notice that with Samples set to 1.0 we get a hard edge to the Shadow but if we change the Samples to 5 we see a much softer edged Shadow.

The Adaptive QMC option calculates Shadow values in a less uniform and distributed way. This is useful in making quick renders. The Constant QMC option calculates Shadow values in a very uniform and evenly distributed way. This option results in more accurate Shadows. Threshold is used for adaptive sampling and is used to determine if the Adaptive QMC shadow sample calculation can be skipped based on a threshold of how shadowed an area is already. Constant Jittered is similar to simulating an array of lights.

Background Images

There may be times when we want to use something other than a gradient for the background so Blender has the option of using a bitmap to create a background.

Let’s make sure we are in Rendered View and go into the World tab. Let’s change the Horizon Color to a light green, the Zenith Color to a gold color, and the Ambient Color to a dark aqua.

Go into Camera View (0 on the Numpad) and turn on the Paper Sky option. This option keeps the characteristics of the gradient but it is clipped in the image. The Blend Sky option blends the background color from horizon to zenith. The Real Sky option keeps the horizon color at the horizon and the zenith color is used above and below the camera.

We can also use images for our backgrounds. This is similar to working with Materials in Blender.

Go to the Texture tab and Choose New and change the Type to Image or Movie and open up your image. I am using a picture of a canyon that I got from Public Domain Pictures (the link is in the description). Then go to the Influence section and turn off Blend because we don’t want to use any of the color we chose under the World options. Now if we turn on the Horizon option we can now see our background image in the Camera View.

We can change the size of the image by going to the Mapping section and changing the Size. In this case, I am going to change the X, Y, and Z coordinates to 2.0.

Ambient Occlusion

Now let’s look at Ambient Occlusion which is similar to ambient lighting but with more shading to give the scene a more realistic look.

Let’s start with a clean scene by going to File > New > Reload Startup File. Make sure the Lamp is selected and then delete it from the scene (X) since Ambient Occlusion doesn’t need a light source.

In order to access the Ambient Occlusion option, go to the World tab and turn on Ambient Occlusion. If we go into Rendered View we notice that our Cube is lit even though we do not have a Lamp in the scene. When we turn on Ambient Occlusion, notice that the Gather option is also selected.

Factor is the strength of the Ambient Occlusion. The Add blending mode represents global illumination. If we change the Factor to 0.25 we notice that the Cube is now darker than when it was set to 1.0. The Multiply blending mode multiplies the Ambient Occlusion over the shading which makes the render darker.

The Ambience is based on the Ambient Color. If we change the Ambient Color to a bright green for example we now see that our overall Ambient Lighting is green.

Under the Gather section with have a Ray Trace option and an Approximate option. Ray Trace is the default and this is used to create the overall Ambient effect. If we change the Samples from 5.0 to 10 we can see there is a reduction in the graininess of the render.

The Approximate option approximates the Ambient Occlusion effect. This can be affective in saving render time and changing the Passes can smooth out the light and dark areas of the render.

Let’s go back to Ray Trace and turn the Samples back to 5.0 and change the Ambient Color back to black. Let’s turn off Ambient Occlusion and turn on Environment Lighting which is another form of Ambient Occlusion.

Environment Lighting pulls its color from the selection we have — which by default, is white. Let’s change the selection to Sky Color and change the Horizon Color to a dark blue and the Zenith color to a very pale blue. Now we have a very simple Horizon and Zenith color gradient in the render.

Let’s change from Sky Color to Sky Texture. Just like we did in the previous lesson go to the Texture tab and Choose New and change the Type to Image or Movie and open up your image. I am using a picture of a canyon that I got from Public Domain Pictures (the link is in the description). Then go to the Influence section and turn off Blend because we don’t want to use any of the color we chose under the World options. Now if we turn on the Horizon option we can now see our background image.

We can change the size of the image by going to the Mapping section and changing the Size. In this case, I am going to leave the X, Y, and Z coordinates at 1.0. Now we see that our Cube is taking on the color of the image.