Lighting and Environment - Creating Detailed 3D Scenes - Blender For Dummies (2015)

Blender For Dummies (2015)

Part II

Creating Detailed 3D Scenes

Chapter 9

Lighting and Environment

In This Chapter

arrow Taking advantage of different types of lights in Blender

arrow Setting up effective lighting

arrow Changing the look of your scene with background images, colors, and ambient occlusion

In terms of getting the work you create in Blender out to a finalized still image or animation, having your scene's environment and lighting set up properly is incredibly important. It goes along hand in hand with setting up materials on your object (see Chapter 7) as well as the rendering process (see Chapter 14). Without light, the camera — and by extension, the renderer — can't see a thing. You could create the most awesome 3D model or animation in the world, but if it's poorly lit, it won't be turning any heads.

This chapter covers the types of lights available to you in Blender and details some of the best practices to use them in your scenes. In addition to lighting details, I go into setting up the environment in your scene with the settings in World Properties. In many ways, the topics covered in this chapter are what give your scenes that final polish, making them look really good.

Lighting a Scene

Lighting has an incredible amount of power to convey your scene to the viewer. Harsh, stark lighting can give you a dramatic film noir look. Low-angle lights with long shadows can give you a creepy horror movie feeling, and brighter high-angle lights can make things look like they are taking place during a beautiful summer day. Or, you can use a bluish light that projects a hard noise cloud texture and makes your scene feel like it's happening under water.

Equally important is setting up your environment. Depending on how you set it up, you can achieve a variety of looks. You can set your scene in an infinitely large white space, commonly known as the white void in film and television. Or, you can adjust your environment such that your scene takes place outside during the day or somewhere on the moon. When you combine good lighting and a few additional tricks, you can make your scene take place just about anywhere. Figure 9-1 shows a pretty simple scene with a few different environment and lighting schemes to illustrate this point.

image

Figure 9-1: Different lighting configurations can drastically affect the look of a scene.

Understanding a basic three-point lighting setup

Before I get too deep into how you light a scene in Blender, you should understand some standard lighting setups and terminology. The cool thing is that most of this information isn't limited to use in 3D computer graphics. It's actually pretty standard in professional film, video, and still photography. In fact, quite a few photographers and directors like to use 3D graphics as a form of previsualization to test out lighting setups before arriving on set for the actual shoot. (And you thought you were just making pretty pictures on a computer screen! Ha!)

One of the most common ways to arrange lights is called three-point lighting. As the name implies, it involves the use of three different sets of lights. It's a common studio setup for interviews, and it's the starting point for nearly all other lighting arrangements. Figure 9-2 shows a top-down illustration of a typical three-point lighting setup.

image

Figure 9-2: A typical three-point lighting setup.

The key light

Setting up a three-point lighting scheme starts with placing your subject at the center of the scene and aiming your camera at that subject. Then you set up your main light, the key light. The key light is usually the most powerful light in the scene. It's where your main shadows come from, as well as your brightest highlights. Typically, you want to set this light just to the left or just to the right of your camera, and you usually want it to be higher than your subject. This placement is to ensure that the shadows fall naturally, and you don't get that creepy flashlight-under-the-chin look that your friends used for telling scary stories around the campfire.

The fill light

After your key light is established, the next light you want to place is the fill light. The purpose of the fill light is to brighten up the dark parts of your subject. See, the key light is great for putting shadows on your subject, but without any other light, your shadows end up being very dark (they're actually stark black if you're rendering with BI), obscuring your subject. Unless you're aiming for a dramatic lighting effect, this effect is not what you normally want. The fill light tends to be less powerful than the key, but you want it to have a wider, more diffuse throw. The throw is the radius of space that the light reaches. For example, a flashlight has a narrow throw, whereas fluorescent lights like the ones used in office buildings throw light wider. You want this wide throw on your fill because it reduces the amount of highlight generated by this light. Typically, you don't want highlights from your fill to compete with the highlights from your key. As far as placement goes, you normally want to place your fill on the opposite side of the camera from the key and roughly at the same height as your subject, perhaps a little lower than your key light.

tip Here's a way to figure out a good place to position your fill light. Draw an imaginary line from your key light to your subject. Now, with your subject as the pivot point, rotate that line 90 degrees. When you do, the line points right where you should place the fill.

The back light

The last light in a three-point lighting configuration is the back light or rim light. This light shines at the back of your subject, creating a small edge of light around the profile. That sliver of light helps separate your subject from the background and serves as the nice little bit of polish that often separates a mediocre lighting setup from a really good one.

Now, I've sat through many long discussions about the best way to position a back light (yes, my friends are nerds, too). Some people like to place it directly opposite from the key light, which works well, but sometimes the rim effect competes with the key's highlights. Other people prefer placing it opposite to the camera, which, too, is a good way to go, but if the subject moves, you risk the possibility of blinding the audience. And yet another group of people recommend placing the back light opposite to the fill. This approach can create a nice rim of light that complements the key, but it also has the possibility of looking a bit unnatural. As you can see, everything is a trade-off when it comes to lighting. In fact, the only really consistent thing that people agree on is that the light should generally point toward the subject. The bottom line is that the best course of action is to play around with your back light and see for yourself where you get the best results.

As for the power and throw, you typically want to use a back light that is less powerful than your key so things appear natural. The throw can vary because the highlights are all on the opposite side of your subject. I personally like to keep it narrow, but a wide throw can work nicely for large scenes.

That's basic three-point lighting for you. It works well in computer graphics as well as the “real world” and it's the starting point for most other lighting configurations. Lower the angle of your key to make your subject creepy. Remove or reduce the power of your fill and back lights to get more dramatic shadows. Place your key behind your subject to get a mysterious or romantic silhouette. And that's just the tip of the iceberg!

Knowing when to use which type of lamp

After you're familiar with the basic principles of three-point lighting, you can use that knowledge to light your scenes in Blender. To add a new light, use Shift+A ⇒ Lamp and you see the menu shown in Figure 9-3.

image

Figure 9-3: Adding a lamp in the 3D View.

remember Although the lamps listed in this section are available in both Cycles and Blender, it's more common to use mesh lamps (that is, using meshes as lights in your scene) than lamp objects in Cycles. See the section later in this chapter titled “Using mesh lights in Cycles” for more on setting up and using mesh lights. Of course, some lamps, like the Spot and Sun lamps are still very useful in Cycles as well as BI, so it's still worth reading through this section if you've chosen Cycles as your renderer.

The Lamp menu (Shift+A ⇒ Lamp) offers you the following types of lights to choose from:

· Point: This type of light is sometimes also referred to as an omni light, meaning that the lamp is located at a single point in space and light emanates in all directions from that point. The default Blender scene has a single light of this type. The Point lamp is a good general-purpose light, but I prefer to use it as secondary illumination or as a fill light.

· Sun: The Sun lamp represents a single universal light that comes from a single direction. Because of this single source, the location of the Sun lamp in your scene doesn't really matter; only its orientation is relevant. This type of light is the only one that affects the look of the sky and is well suited as a key light for scenes set outdoors.

· Spot: In many ways, the Spot is the workhorse of CG lighting. It works quite a bit like a flashlight or a theater spotlight, and of all the light types, it gives you the most control over the nature of the shadows and where light lands. Because of this control, Spots are fantastic key lights.

· Hemi: A Hemi lamp is very similar to the Sun lamp in that it doesn't matter where you place the lamp in your scene. Its orientation is its most important aspect. However, because it's treated as a full hemisphere of light around the scene, lighting from a Hemi tends to be softer and flatter than the sun. Hemis are also the only Blender lights that cannot cast shadows when rendering with BI. Technically, Hemi lights are not supported in Cycles. They're treated exactly the same as Sun lamps. In BI I like using Hemis for fills and back lights. They're also handy for outdoor lighting.

· Area: Area lights are powerful lights that behave similar to Spots; however, the shadows tend to be softer and more accurate because they're based on having a grid of lights to work with. As a result, they work well for key lights, but because they tend to take more time to process, you should use them sparingly. Generally, you only use Area lamps when rendering with BI. If you want the effect of an Area lamp in Cycles, it's more common to use a mesh as your light source.

Figure 9-4 shows what each light type looks like in the 3D View.

image

Figure 9-4: From left to right, Point, Sun, Spot, Hemi, and Area lights.

Universal lamp options

When you've chosen a type of lamp and added it to the scene, the controls to modify these lamps are in Lamp Properties. When you have a lamp selected, the Lamp Properties button in the Properties editor features a lamp icon. With a couple of exceptions, all the lamps share a few of the same controls. Figure 9-5 highlights the options that are universal for nearly all lights.

image

Figure 9-5: Panels and options available for all lamp types. On the left are the options specific to Cycles and on the right are properties available when using BI.

One cool thing about Blender's lamps is that you can instantly change lamp types whenever you want. Simply select the lamp you want to work with and choose the type of lamp you would like it to be in the Lamp panel. This feature is great for quickly sorting out the type of light you want to use. You can test out different lighting schemes without cluttering the scene by having a bunch of extraneous lights that you have to move to other layers or hide.

Between Cycles and BI, only a few options are available to lamps in both. In Cycles, these properties are in the Nodes panel of Lamp Properties (technically, they're properties of the Emission shader in the Node Editor). In BI, they're the first two options in the Lamp panel of Lamp Properties:

· Strength (Cycles)/Energy (BI): The Strength value (or Energy if you're rendering with BI) controls the strength of light emitted by the lamp. When rendering with BI, I rarely set the Energy to a value greater than 1.000, but when you need it, it's handy to have the option. When rendering with Cycles, the Strength value may often be much higher. It's useful to think of lamp strengths in Cycles similar to how you may think of watts on light bulbs.

· Color: To set the color for your lamp, left-click the color swatch and use Blender's color picker.

Like with materials for objects, you can also apply textures to your lights and apply them to the lamp's color, its shadow's color, or both. This ability is a great way to use lighting to either enhance the environment of your scene or fake certain lighting effects that are typically only achievable with ray tracing. One specific example is caustic effects. If you have some free time, take a glass of water and shine light through it. Due to the refractive nature of the glass and the water, usually you see a strange light pattern on the table near or around the glass. That effect is an example of caustics and (if you don't need 100 percent accuracy) you can fake it with a Clouds texture on a Spot lamp.

On a larger scale, caustics are what make the cool moving patterns you can see on the bottom of a swimming pool. To add a texture to your selected lamp, use Texture Properties and use the same procedures covered for texturing materials as described in Chapter 8.

remember Technically speaking, you shouldn't have to fake caustics if you're using Cycles, because they're naturally built-in. However, caustic effects tend to take a long time to converge or appear cleanly when rendering with Cycles, requiring a lot more samples than you may want to use. For that reason, it still makes sense to occasionally help Cycles along by faking caustics with a texture.

That's pretty much it for the truly universal lamp properties across both render engines. However, after you choose a specific renderer, a few more options are available for all lamps. The next two subsections cover those properties. I encourage you to read both sections so you have a firm understanding of what's available to you in each renderer.

Cycles lamp properties

The amount of properties available to lamps in Cycles is really quite sparse. However, the upside is that those options are very powerful and (for the most part) available to all light types. These options are available to you with all lamps in Cycles:

· Size: Technically speaking, a lamp isn't much different from an Empty. It's just a point in 3D space. It doesn't really have any geometry, so scaling a lamp in the 3D View is pretty meaningless (in both renderers). However, because Cycles is a ray tracer, it needs a surface to emit light from, even if it's not technically real. The Size property lets you adjust the size of that virtual surface.

The thing to remember is that if you increase the Size of your lamp, but leave its Strength value unchanged, it's still the same amount of light, but it's starting off more dispersed. This gives your shadows softer edges, though with the trade-off of having overall weaker illumination from the lamp.

· Max Bounces: Because Cycles is a ray tracer, it's all about rays bouncing around your scene. It's a bit of a simplified description, but imagine one ray coming from your lamp. If Max Bounces is set to 0, that ray hits an object in your scene and stops. All it does is illuminate that object (much like lighting in BI). However, if you increase the maximum number of bounces, you allow that ray to reflect off of objects it strikes.

This reflecting behavior from bounced rays allows for the realistic color bleeding effect that's the hallmark of global illumination. Color bleeding is when light reflected from one surface takes on part of that surface's color. So if you have a bright red object in your scene and Max Bounces is set reasonably high (like the default value of 1024), other objects near your red one will take on a slightly reddish hue from the reflected light.

· Cast Shadow: Cycles' lamps have far fewer controls for shadows than their BI counterparts. However, they retain the ability to disable shadow casting with this check box. This option is an attractive feature that you get with lamps that isn't available if you use mesh lamps.

Why would you want to disable a lamp's ability to cast shadows? In a three-point lighting setup, you often want your fill light to illuminate the scene without contributing unnecessary shadows. In meatspace, lighters go through a lot of efforts and tricks to try doing this; usually by trying to make the shadows from the fill light very soft. In CG it's much easier: you just turn shadows off. Neat, huh?

tip With mesh lights (or any meshes, really), you can turn off shadows by disabling the Shadow check box in the Ray Visibility panel of Object Properties.

· Multiple Importance: This check box toggles whether the lamp uses multiple importance sampling. Simply put, multiple importance sampling is an algorithm that allows Cycles to more intelligently choose which rays to use for lighting your scene. Having this kind of intelligence in sampling becomes important on larger lights and especially on materials with sharp reflections. Generally, you want to leave this check box enabled. You can read up more on sampling in the sidebar in this chapter titled “Adaptive QMC and Multiple Importance Sampling.”

BI lamp properties

This section details the wide assortment of properties available to lamps when rendering with BI. On a technical level, Blender Internal tends to use more tricks and fakery in how it handles lights and shadows. As a result, there are more controls for you to fidget with.

The Distance value is only available for the Point, Spot, and Area lamps. The value is in the units defined in the Units panel of Scene Properties and, if an object is farther away from the light than that distance, it receives no light. For each of the light types, an indicator defines the range of this value. For the Area lamp, it's a line pointing in the direction that the light is facing. For the Spot, it's the length of the cone. For the Point lamp, no indicator is on by default, but if you enable the Sphere check box in the Lamp panel, a dashed circle appears to indicate the distance of the Point lamp’s throw. If you don't see this circle immediately, you may have to zoom out in the 3D View so that you can see it.

remember Be careful when enabling the Sphere check box on the Point lamp. It subtly changes how the light works. With Sphere enabled, light coming from the Point lamp starts to weaken, or attenuate, starting at the light's location, so by the time it gets to the Distance value, no light is available. However, if you have Sphere disabled, that attenuation doesn't start until you actually reach that Distance value, so you have a farther throw. Having Sphere enabled makes the light behave more like it would in meatspace, but it's often more convenient to keep it disabled. In either case, you can control how dramatically that attenuation occurs by using the Falloff drop-down menu. The default value of Inverse Square behaves the most like real-world lights.

technicalstuff Lamps in Cycles don't have a Distance value, because all light sources in Cycles share a physically correct falloff rate. Incidentally, all natural light follows the inverse square law for falloff. That means that as you get farther from a light source, the strength of its light decreases by the value of 1/distance2. So, if the Strength value of your lamp is 100, when you're 1 Blender Unit away, the light's effective strength is 50. At 2 Blender units away, the light's effective strength is 25. And by the time you get just 5 Blender units away from your light source, the effective strength has dropped to just a value of 4. So to make a scene brighter, you need to either make one very strong light source (which may be too bright and overpower the scene) or add multiple smaller lights.

When rendering with BI, each lamp except for the Hemi has the option of using ray tracing to cast shadows. Ray traced shadows are enabled by left-clicking the Ray Shadow button in the Shadow panel, and it's the default behavior for new lights. Know, however, that using ray traced shadows can drastically increase your render times in Blender Internal. The next section goes more deeply into some techniques for optimizing your lighting to try to deal with that. However, if you do want to use ray traced shadows in BI, you should be aware of a few options:

· Shadow color: Left-click this swatch to get a color picker for selecting the color of your cast shadow. Of course, this isn't physically accurate. Real-world shadows are always black unless other lighting is present.

· Samples: This option dictates how many samples the ray traced shadow uses. Increasing this value increases the accuracy of the shadows at the expense of longer render times.

· Soft Size: This option controls how blurry the edge of your cast shadows are. The higher the value, the blurrier the shadow. However, with only one sample (the previous option), the shadows won’t blur that much. Blurry shadows require more samples.

· QMC Sampling Types: You generally have the choice between Adaptive QMC and Constant QMC. QMC stands for Quasi-Monti Carlo and is an algorithm for taking random samples. Generally speaking, the Adaptive QMC setting gives you faster render times and better results.

· Threshold: This option is available only when you choose the Adaptive QMC sampling type. It basically helps the renderer decide which samples to use and which ones to ignore. A higher Threshold value shortens your render times, but may decrease accuracy.

technicalstuff Adaptive QMC and Multiple Importance Sampling

Without getting too deep into all the crazy mathematical details, understanding QMC in BI and multiple importance sampling in Cycles requires knowing a little bit more about how ray tracing works. In Chapter 7, I give a brief description of ray tracing that says it's done by tracing each and every vector from the camera to objects in your scene, including light sources. This description is somewhat oversimplified. Tracing every single vector would take an incredibly excessive amount of time. In order to get around that, programmers decided to take a sampling of those vectors and approximate everything between them. To choose which sample vectors to select, they first tried just randomly picking them. The problem, though, is that raw random selection doesn't give consistent or accurate results. Samples aren’t necessarily where they're most useful (like in reflections and highlights). So to accommodate that, it was decided that samples could be random, but evenly dispersed. Evenly dispersed random sampling is basically constant QMC. Of course, the downside to constant QMC is that you still might be taking samples from parts of the scene that don't need very many. If you can stay random, but have more of the samples taken from busier parts of the scene, you might get better performance. This logic is behind adaptive QMC as well as multiple importance sampling.

Light-specific options

As you can see in Figure 9-5, the Point lamp has options that are available on nearly every other lamp but doesn't have much in the way of unique controls. The same could actually be said of the Hemi lamp. In fact, it has even fewer controls because Hemis can't cast shadows in BI and aren't supported at all in Cycles. However, the remaining three lights have some interesting options that allow you to optimize their usage to meet your needs.

Options specific to Sun lamps

The Sun lamp is incredibly useful because it has the ability to behave more like the real sun. It's the only type of light in BI that influences the look of the sky and even provides some atmospheric effects. You control this lamp in BI with the Sky & Atmosphere panel that appears when you set your lamp to be a Sun.

remember The Sky & Atmosphere panel is not available to the Sun lamp in Cycles. In Cycles, those settings are handled with World Properties. I cover that in more detail in this chapter in the section titled “Setting Up the World”.

By default, both the Sky and Atmosphere check boxes are disabled, but you can enable them with a left-click. Figure 9-6 shows the options as they pertain to the Sun light type in BI. In Cycles, the Sun lamp has no additional properties beyond the general lamp properties.

image

Figure 9-6: Controls for the Sun lamps.

When you enable the Sky check box, you can use the controls in its panel to determine how the Sun lamp influences the sky background. At the top of the panel is the Turbidity value. Keep Turbidity low for clear day skies and increase it for hazy, overcast skies. When you see the sky on a clear day — the real sky outside; you know, in the for-really-real world — it's lighter near the horizon and darker as you look farther up. The Brightness and Size values under the Horizon label control this effect in Blender. The Brightness and Size values under the Sun label adjust your sun's visibility.

remember If you try to render your scene, you may not see the sun in your sky, even if you've placed the Sun lamp within your camera's view. Because the position of the Sun lamp is irrelevant and only its orientation is important, you have to rotate the lamp so that it points in the opposite direction of the camera's orientation.

When you enable the Atmosphere check box, you can control the sun's influence on how the air in your scene looks from a distance. These options are best suited where you have a wide outdoor shot of your scene’s environment. There's really no good way to preview the effects of these values other than to do test renders or use Rendered viewport shading (Shift+Z) in the 3D View. Here's a quick guideline to help understand what each one does:

· Sun: This value adjusts the influence of the Sun's intensity on the atmosphere. Increasing it makes objects in the distance bluer.

· Distance: This value controls the distance that the atmosphere has an influence. At low values, you see everything. Increasing this value, the light becomes yellower, and distant objects become more like silhouettes.

· Inscattering: Increasing this value makes the light appear to scatter more between the camera and the objects it's pointing at. Set this value to 1.0 for the most physically accurate results.

· Extinction: Lower numbers for this option reduce the amount of detail seen in your objects. This setting is similar to Distance, except it doesn't really matter how close objects are to the camera. Like Inscattering, you get the most physically accurate results with a value of 1.0.

Options specific to Spot lamps

When working with Spot lamps in BI, you have the option of two different ways to cast shadows: ray tracing or buffers. The simplest way to know the difference between the two is to know that, generally speaking, ray traced shadows are more accurate whereas buffered shadows render faster. In Cycles, all shadows are ray traced.

Regardless of which type of shadows you cast (if you decide to cast shadows at all with this lamp), a handful of settings are available in the Spot Shape panel:

· Size: This setting controls the width of the Spot's throw, measured in degrees. So a value of 180 degrees is completely wide, whereas a value of 30 degrees gives you a narrower cone. Unless I'm doing something special, I like to start with my Spots with a Size value around 60 degrees.

· Blend: The Blend value controls the sharpness of the edges at the boundary where the Spot's cone of influence ends. Lower values give you a crisp edge, whereas higher values soften it, making the light appear more diffuse.

· Halo: Enabling this check box allows the renderer to show the full cone of light generated by the Spot. This is called volumetric light. You see this effect when you use a flashlight in a dusty room or when you want the “sunbeams from the sky” effect. This property is only available if you're rendering with BI. If you're using Cycles, you need to actually have an object with a volumetric material that your lamp shoots light through.

· Intensity: Specifically speaking, this value controls Halo Intensity. This value has no influence unless you enable the Halo check box. If Halo is enabled, increasing this value brightens the volumetric effect. And, like the Halo value, the Halo Intensity property is only available if you render with BI.

· Square: Enable this check box if you would prefer the Spot lamp to come from a square source rather than a round one. This option is only available when rendering with BI. To get a square cone in Cycles, you actually need to project the cone of your lamp through a square hole (like in the real world).

· Show Cone: This feature is incredibly cool and useful. When you enable the Show Cone check box, Blender allows you to more clearly see the volume of the cone, making it much easier to see what objects are within your Spot lamp's influence area.

Using buffered shadows instead of ray traced ones, the options in the Shadow panel change. All the ray traced shadow controls are replaced with a different set of options because buffered shadows use an image-based process instead of ray tracing. You have more ways to control how the shadows look because you're no longer constrained by the limits of reality. Figure 9-7 shows the various settings for a Spot lamp with buffered shadows.

image

Figure 9-7: Controls for a buffered Spot lamp.

Trying to sort out all these controls can be daunting. However, the following values are the most important ones that you should know about:

· Sample Buffers: In essence, Sample Buffers are basically the same as the Samples values discussed elsewhere throughout this chapter, but they’re specifically for helping render hair and fur more effectively. Higher values give better results, but at the cost of more system memory when rendering. Unless you're rendering hair or fine detail, keep this set to 1.

· Size: The technique that buffered shadows uses for generating shadows is image-based. The shadow buffer size is the resolution of the image used to create the shadows. Lower values work faster, but look more jagged.

tip To avoid jaggies in your buffer shadows, consider the size of your final rendered image. Think about how many pixels the shadow area will take (including any part of that shadow that goes off-camera). The shadow buffer size should be large enough to cover each of those pixels.

· Samples: Each sample is an offset copy of the shadow buffer. Soft shadow edges come from mixing samples, so a higher value makes them look better. Render time does increase with more samples, but because buffered shadows are typically much faster than ray traced shadows, it's okay to splurge a bit and allow yourself a few extra samples.

· Soft: Increasing this value makes your shadows softer and blurrier. To use this setting effectively, make sure that you have a Samples value greater than 1. And at the same time, you get the best results by not setting the Soft value higher than double your Samples value. So at the default Samples setting of 3, you should keep your Soft value below 6.

· Bias: This value offsets the shadow from where it connects to the shadow-casting object. Occasionally, you may get some weird jaggies or artifacts in your shadows. Increasing the Bias can help get rid of those artifacts, but you should keep this value as small as possible. If you do have to adjust the Bias, adjust it only as low as it can go before you get artifacts in your renders. Otherwise, your shadows will begin to look very unnatural. A good practice is to do a series of test renders starting with a Bias value of 0.1 and working your way up until you no longer see artifacts.

· Clip Start/Clip End: Consider these values as a secondary control in addition to the Distance value in the Lamp panel. Objects that appear within these two values, indicated by a line on the Spot lamp in the 3D View, cast shadows, whereas objects outside of this range do not. Keeping the Clip values as close to your shadow-casting objects as possible gives you the most accurate results. If you don't want to adjust these values manually, enable the Autoclip check box to either value. Blender then automatically sets the Clip values to include objects within the Spot's cone.

· Halo Step: This value is in the Spot Shape panel and has an effect only if you have the Halo check box enabled. Adjusting it controls your volumetric shadow, or how much of the volumetric effect your object blocks. Higher values render faster, but are less accurate. Setting it to 1 gives you the best, albeit the slowest, results. However, setting it to 0 means that you have no volumetric shadow, so you have the volumetric cone, but your object won't block it at all.

Options specific to Area lamps

Area lamps are very similar to Spots, except Area lamps can only use ray tracing for creating shadows. The shadows are generally smoother and more accurate; however, they can increase your render time dramatically. Figure 9-8 shows the options and settings for Area lights.

image

Figure 9-8: The controls for Area lights.

The way an Area light works is pretty simple. Imagine that at the lamp's location, you don't have a single light, but instead you have a grid of lights, and you can control the width and height of this grid as well as the number of lights in it. As a result, you have even more control over your lamp's throw.

To control the dimensions of your Area lamp, use the Size value in the Area Shape panel. This size is measured in units chosen in Scene Properties and, by default, controls both the width and the height of the Area lamp. You control the number of lights in the Area lamp by adjusting the Samples value in the Shadow panel. Because the default shape of the lamp is a square, increasing the number of samples gives you the square of the sample value. So setting Samples to 3 creates 9 lights in the grid, and setting it to 5 creates 25 lights in the grid.

If you’d rather have a rectangular Area lamp, left-click the Rectangle button in the Area Shape panel. If you're rendering with Cycles, there's a Shape drop-down menu in the Lamp panel where you can choose between having a square and rectangular shape for your Area lamp. When you switch the shape to being a rectangle, you can set the width (Size X) and height (Size Y) of your Area lamp. In addition, the Samples value in the Shadow panel changes to Samples X and Samples Y, giving you control over the number of horizontal and vertical lights you have on your Area light's grid. The total of lights you have in the grid is the value of Samples X multiplied by the value of Samples Y. Figure 9-9 shows an illustration of how the lights are arranged in square and rectangular Area lamps.

image

Figure 9-9: Light arrangement on a square (left) and rectangular (right) Area light.

tip When working with Area lights, remember that you actually have multiple lights arranged on the lamp's grid, which can make an Area light with an Energy of 1.0 excessively bright in BI. So if you use an Area lamp, try a much lower Energy value. Depending on the number of samples in your Area lamp, you may want to start as low as 0.050.

Using mesh lights in Cycles

When rendering with Cycles, it's more common to use mesh lights than lamp objects, especially if you want the effect of an Area lamp. Part of this is historical — it used to be that you'd get much shorter render times using meshes as lamps than by using lamp objects. The other reason is more practical: Often, lights take on a specific shape that's more complex than the simple look of lamp objects.

Making any object a light source in Cycles is incredibly easy. You don't even really need to use the Node Editor (at least, not for a simple setup). With your object selected, just follow these steps:

1. In the Surface panel of Material Properties, change the Surface drop-down menu to Emission.

2. Adjust the Color and Strength values to taste.

That's it! From the perspective of your material's node network, you've connected an Emission shader to the Surface socket of your Material Output node, as shown in Figure 9-10.

image

Figure 9-10: Emitting light from any mesh in Cycles is as easy as wiring an Emission shader to the Surface socket of your Material Output node.

remember One side effect of using a mesh to light your scene is that (unlike lamp objects) meshes are visible objects in your scene, just like they would be in meatspace. The absolute easiest solution is to try to keep your mesh lights off-camera. Sadly, that's not always possible. It would be really nice if you could get the benefits of mesh lights and still keep the mesh object itself invisible from the camera. Fortunately, that's pretty easy to do. Just disable the Camera check box in the Ray Visibility panel of Object Properties.

There's another way to get those results as well. It isn't as simple as a check box and requires a bit of wizardry in the Node Editor (specifically the Light Path node). However, by using the Node Editor, you open the door to the possibilities of much more complex and interesting lighting. Assuming you have a mesh light set up like in Figure 9-10, use the following steps in the Node Editor:

1. Add a Transparent BSDF shader node (Shift+A ⇒ Shader ⇒ Transparent BSDF).

For organization's sake, place the Transparent BSDF node below your Emission node.

2. Add an Mix Shader node (Shift+A ⇒ Shader ⇒ Mix Shader).

For placement, put the Mix Shader node to the right of your Emission and Transparent BSDF nodes, but to the left of your Material Output node. You may need to push your nodes around a bit to give enough space.

3. Connect the Emission socket of your Emission node to the upper Shader socket of the Mix Shader node.

4. Connect the BSDF socket of your Transparent BSDF node to the lower Shader socket of the Mix Shader node.

If you preview your scene in the 3D View with Rendered viewport shading (Shift+Z), you should see that your mesh light object emits light, but is semi-transparent. If you adjust the Fac slider in the Mix Shader node, a value of 0, your mesh emits light, but it's completely solid. At a Fac value of 1, your mesh is transparent, but it doesn't emit any light. That's close, but not quite right. The magic happens in the next two steps.

5. Add a Light Path node (Shift+A ⇒ Input ⇒ Light Path).

For organization, place the Light Path node above your Emission node. The Light Path node is an excellent node in Cycles that's useful for all sorts of interesting trickery. The next step will prove the point.

6. Connect the Is Camera Ray socket of the Light Path node to the Fac socket of your Mix Shader node.

Like magic, your mesh object is invisible in the scene, but it's still emitting light.

technicalstuff The technical explanation for what you've done goes something like this: Your mesh object checks each ray that comes in contact with it and determines where that ray came from (the camera, another light source, a shadow, and so on). Then, by wiring the Is Camera Ray socket to the Fac socket on the Mix slider, you're making your material say, “If I'm hit with a camera ray, behave as if I'm transparent, but if I'm hit with any other ray, behave as if I'm a light.” And there you go: a mesh light that behaves like a lamp object.

Figure 9-11 shows what your finished node network should look like.

image

Figure 9-11: Getting a mesh light to be invisible in your scene requires playing with the Light Path node.

Lighting for Speedy Renders

Six additional controls for lamps exist if you're rendering with BI. I like to refer to them as my “cheat buttons” because they're incredibly useful for achieving lighting effects that are difficult or impossible in the real world. The functions that these options control are really what make lighting in 3D computer graphics so powerful. More often than not, if you use these controls effectively, they can speed up your render times without having a negative effect on the overall quality of your image. Figure 9-12 highlights these controls in Lamp Properties.

image

Figure 9-12: The cheat buttons in the Lamp panel.

Here are descriptions of each cheat button in the Lamp panel:

· Negative: What this check box enables is, in my opinion, one of the coolest capabilities in CG lighting: inverting the light's output. You can basically shine darkness on your scene, an impossibility in meatspace that opens the door to all sorts of interesting uses. If part of your scene is too bright or you want to have deeper shadows, don't play with adjusting the Energy of your lights or increasing the Samples for your shadows. Just shine some darkness on the area with a negative light!

tip You can use negative lights in Cycles, too. It's just a bit hidden. Left-click in the Strength value's field and manually change it to a negative number (like -1 or -10). Boom! Negative lights in Cycles.

· This Layer Only: Enabling this control makes the light illuminate only the objects that are on the same layer as the light. In real-world lighting, technicians do a lot of work to hide or mask out some lights, so they illuminate only certain parts of the scene. For example, you may want to brighten up the environment without making the lighting on your characters any brighter. Because you're in CG, you don't have to mask anything out: You just enable this check box and make sure that your characters aren't on the same layer as the light. Unfortunately, there's no easy way to get this feature in Cycles yet. For that, you'll need to use some clever organization of your render layers and Blender's node compositor (see Chapter 15).

· Specular: In three-point lighting, you want to reduce the highlights produced by the fill so that they don't compete with the key's highlights. Meatspace lighting technicians often attempt to reduce the highlights by diffusing or dispersing the fill as much as possible. In BI, you don't have to go through the trouble. You can just turn off the lamp's specular highlights altogether by disabling this check box. Pretty sweet, huh?

In Cycles, you don't have this option. Your choices are to work like a real-world lighting technician: either try disabling multiple importance sampling in your lamp, or disable the Glossy check box in the Ray Visibility panel of Object Properties.

· Diffuse: Sometimes when you're lighting, you want to have fine control of your highlights, but you don't want to change the basic illumination of the scene. If you turn off shadow casting for the light and disable this check box, you're basically left with a specular highlight that you can move around your subject at will. This feature isn’t commonly used, but having it available has certainly made my life easier more than once. In Cycles, you can turn off diffuse lighting by disabling the Diffuse check box in the Ray Visibility panel of Object Properties for your light source.

The last two cheat buttons are in the Shadow panel, farther down Object Data Properties for lamps. The following describes each one:

· This Layer Only: This check box works like the corresponding check box in the Lamp panel, but only relates to shadows. Like the Lamp panel option, this feature isn't available in Cycles.

· Only Shadow: Enabling this option allows your lamp to cast shadows without adding more light to the scene. I sometimes use this option to reduce render times by using buffered Spots for shadows while using other lamps without shadows for main illumination. Unfortunately, there's no easy way to achieve this with Cycles materials. All solutions for getting this effect in Cycles involve compositing (see Chapter 15).

remember Any object — even lamps — can exist on multiple layers. This ability dramatically increases the power of layer-only lamps and shadows. With the lamp selected, press M to reveal the layer selection pop-up. To place your lamp on more than one layer, Shift+left-click the layer buttons you want it on.

I often tell people that when it comes to computer graphics, if you're not cheating or faking something, you're probably doing it wrong. Even though you can get great results by using ray traced shadows everywhere with the highest number of samples, these results all come at the expense of high memory usage and lengthy render times. So your scene may look perfect, but if you're taking 16 hours to render every frame in an animation, you could be rendering for a month and not even have two seconds of it done.

A large part of being a CG artist is doing everything you can to reduce the amount of work that needs to be done by both you and the computer, while still creating high-quality images. You don't want to be old and gray by the time your first animation is complete. That’s why CG artists worry so much about keeping their render times as short as possible and why they use features like these cheat buttons to cut corners where they can.

Working with three-point lighting in Blender

My preferred lighting rig in Blender usually starts with a three-point lighting setup. Here’s what I normally start with:

· Key: A buffered Spot works well as the key light in BI. Keep all settings at their default values except for the spot Size, Clip range, and Bias. Set the Spot Size to 60 degrees and activate the Autoclip check boxes for the Clip Start and Clip End values. For Bias, lower it as much as possible until just before you start seeing artifacts in your renders. If you don't feel like fiddling with settings, you can also use ray traced shadows on your Spot lamp, though it will increase your render times. In Cycles, I may use a Spot lamp as my key, but more frequently, I use a mesh light.

· Fill: In BI, I typically start with a Hemi with an Energy of 0.5 and the Specular check box disabled in the Lamp panel. In Cycles, I may use a large Area lamp or Sun lamp with Cast Shadows and Multiple Importance options disabled. Occasionally, I may also use a large plane as a mesh light with a low Strength value.

· Back: This is the tricky one. In BI, I also use a Hemi, but the Energy is usually between 0.75 and 1.0 to get a nice rim light. The lamp is behind the subject, so specularity doesn't matter as much, but just to make sure that it doesn't compete with the key's spec, I normally disable the specularity on this light as well. Don't get too picky with the location of the back light just yet. Back lighting in BI is a bit of a mystical art with a lot of trial and error per shot; it's one of the rare situations where real-world lights have an easier time yielding the desired effect. For that reason, you end up tweaking the location of the back light a lot, so it's not critical that you get it right the first time in your initial setup. In Cycles, a Spot lamp usually can work well as a good back light.

This setup is good for studio lighting, and it works really well for scenes set indoors or for lighting isolated objects. I include an example three-point lighting .blend file on the website www.blenderbasics.com.

tip The only problem with using a Hemi as your back light in BI is that Hemis don't cast shadows at all. This lack of shadows can be an issue, for example, if you're lighting a character who's speaking. If you use a Hemi as your back light, you find that the interior of the character's mouth is unnaturally lit because the Hemi doesn't allow the character's head to cast a shadow on the inside of the mouth. In this situation, you may be better off back lighting with a Point light or a wide-angled Spot.

Creating a fake Area light with buffered Spots

Using a buffered Spot as your key works nicely, but an Area light can usually give you softer shadows. However, in BI, Area lights can only use ray tracing for shadows, and you have somewhat limited control of the Area lamp’s shape because it can be only a flat square or rectangle. In Cycles, you can get around that pretty easily by explicitly modeling a mesh light to whatever shape you want. But in BI, to get around these limitations, you need to get a bit creative with buffered Spots and use them to make your own Area light. To make your own custom Area light out of Spots in BI, start with the three-point rig in the last section and then go through the following steps:

1. Create a circle mesh (Shift+A ⇒ Mesh ⇒ Circle).

2. In the Last Operation panel (F6 or the bottom of the Tool Shelf), set the number of vertices to 8 and the radius to 2.0; also enable the Fill check box.

3. Add the Spot to your selection (Shift+right-click), making it the Active object.

Adding the circle object makes it selected by default, so all you should have to do is Shift+right-click the buffered Spot you're using as your key.

4. Copy the location and rotation of the Spot to the circle object.

To do so, open the 3D View's Properties region (N), right-click any of the Location values, and choose the Copy to Selected option from the menu that appears. Then do the same sequence on one of the Rotation values. The circle appears in the same place as the Spot with the same orientation.

5. Make the circle your Active object (Shift+right-click).

Both the Spot and the circle are still selected, but now the circle is active.

6. Parent the Spot lamp to the circle (Ctrl+P ⇒ Make Parent).

Now if you just have the circle selected and try to move it around, the Spot follows.

7. Turn on Dupliverts for the circle (from Object Properties, Duplication ⇒ Verts).

Dupliverts are a cool part of Blender. When you have an object parented to a mesh, activating Dupliverts on the mesh object places a copy of the child object at every vertex on the parent.

You now have an Area light created by buffered Spots arranged on a custom shape.

8. Select your Spot and adjust its settings to taste.

I typically use the following settings as my starting point:

· Energy: 0.200

· Blend: 1.000

· Samples: 8

· Soft: 16.00

· Clip Start/Clip End: These values may need to be manually adjusted to make sure that the shadow appears properly.

Figure 9-13 shows a circular Area light created with buffered spots.

image

Figure 9-13: Using dupliverted buffered Spots to create a buffered Area light.

Dealing with outdoor lighting

What if you have a large scene or your scene is set outdoors? The limited lighting cone of a single Spot or Area lamp makes it difficult to illuminate the whole scene in a believable way. In Cycles, the best solution is to use the Sun lamp and then make adjustments to your World Properties (covered later in this chapter). For a large or outdoor scene in BI, I usually bounce between one of two solutions. Both of them also involve the Sun lamp.

The easiest solution to implement is to change the buffered Spot in the earlier three-point lighting setup into a Sun with ray traced shadows. You get shadows for all objects in your scene, and with the sky and atmosphere settings, you can get a really believable result. That said, lighting your scene this way brings two disadvantages. First, it uses ray tracing for your shadows in BI, which can increase your render times if you're not careful. And second, because the Sun illuminates the same everywhere, you don't have as much control over individual shadows. This second point is the bigger issue of the two.

Compared to Cycles, ray tracing in BI is almost painfully slow, but it isn't horrible (and it's a lot faster than it was in earlier versions of Blender). In some cases, it may be faster to just go ahead and use ray traced shadows instead of fiddling with all the settings involved with Spot lamps. I know of a few projects (my own included) where, in the time I spent trying to get the perfect Spot light settings, I could have rendered my scene with ray tracing and just been done with it.

That said, an alternative solution to using ray traced shadows from a Sun lamp is to keep the Sun for full scene lighting and atmosphere, but leave the shadow creation to the Spot light. To do so, begin with the previous basic three-point lighting rig for BI and proceed with the following steps:

1. Add a Sun lamp (Shift+A ⇒ Lamp ⇒ Sun).

I like to put the Sun at the center of the scene. (Press Shift+S ⇒ Cursor to Center to put the 3D cursor at the center before adding the Sun.)

2. Add the buffered Spot to your selection (Shift+right-click).

The newly added Sun is selected by default. Shift+right-clicking the Spot also selects it and makes the Spot lamp the Active object.

3. Copy the Spot light's rotation.

From the 3D View's Properties region, right-click one of the Rotation values and choose Copy to Selected. Now light from the Sun is coming from the same direction as the Spot. Location for the Sun is irrelevant.

4. Make the Spot lamp a shadow-only lamp (from Lamp Properties, Shadow ⇒ Only Shadow).

5. Disable shadows on the Sun by selecting the Sun (right-click) and then disabling ray traced shadows by left-clicking the Ray Shadow button in the Shadow and Spot panel.

Done! If you have other objects in your scene that need shadows, make a linked duplicate (Alt+D) of your shadow-only spot and position the duplicate by grabbing (G) it to the correct location.

Setting Up the World

When you set up your scene for rendering, lighting is really only part of the equation. You must also consider your scene's environment. For example, are you outdoors or indoors? Is it daytime or nighttime? What color is the sky? Are there clouds? What does the background look like? You have to consider these factors when thinking about the final look of your image. Whether you're rendering with Cycles or BI, your starting point for setting up your environment are in World Properties, as shown in Figure 9-14.

image

Figure 9-14: On the left is World Properties when Cycles is the active renderer and on the right is World Properties when using BI.

Changing the sky to something other than dull gray

If you've worked in Blender for a while and gotten a few renders out, you might be pretty tired of that dull gray background color that the renderers use by default. Here's where you change that color:

· In Cycles: Left-click the color swatch in the Surface panel of World Properties.

· In BI: Look in the World panel of World Properties. The leftmost color swatch sets the horizon color. You can adjust it by left-clicking the color swatch and using the color picker.

To the right of the horizon color is the zenith color. You may notice that trying to change this color doesn't seem to affect the background color at all. By default, Blender is set to use only the horizon color, so you end up with a solid color as the background. To change this default, left-click the Blend Sky check box in the World panel. When you do, the Preview shows a linear gradient that transitions from the horizon color at the bottom to the zenith color at the top. If I'm doing a render where I just want to see a model I've created, I often use this setup with my horizon color around 50 percent gray and my zenith color nearly black.

Of course, the next question you might have is, “Okay, so I'm using BI. What do the other check boxes in the World panel do?” I'm glad you asked. You can actually activate any combination of these check boxes. Here is a description of what each option does when enabled:

· Paper Sky: You typically use the Paper Sky setting with both Blend Sky and Real Sky also enabled. This setting keeps the horizon at the center of the camera, no matter where it's pointing. It also adjusts the gradient to make sure that the full zenith and horizon colors are visible.

· Blend Sky: Blend Sky enables a gradient going from the horizon to the zenith. When enabled by itself, the horizon is always at the bottom of the camera view and the zenith is at the top.

· Real Sky: Enabling Real Sky sets the horizon to the XY ground plane and the gradient to the zenith color along the global Z-axis. A bonus is that, because the horizon is locked to the XY ground plane, the gradient rotates with the camera, giving a much more realistic feeling to the background. I'm very fond of this setting, especially if I'm using a texture in the background.

Figure 9-15 shows a simple scene rendered with the various combinations of the Blend Sky check box enabled with the other two options so that you can get a better idea of what they do.

image

Figure 9-15: Ways to control the Blend gradient and the horizon.

Modifying the World in Cycles

Comparing the options available in World Properties when rendering with BI to those available when using Cycles (look back to Figure 9-14), you may note that World Properties in Cycles seems. . . sparse. This is because, as far as Cycles is concerned, the World is just another kind of material. Therefore, most of your customization happens in the Node Editor.

To see what I'm talking about, split or change an area into a Node Editor (Shift+F3). To the right of the menus in the header are six buttons (two sets of three). The fifth button has an icon that looks like a globe; left-click that button and you can edit the World material for your scene.

tip If you don't see any nodes in the editor, try pressing Home to make your whole node network visible. If you still don't see any nodes, try enabling the Use Nodes check box in the Node Editor's header. If you still don't see any nodes after all that, double-check that you're actually using Cycles as your render engine. You should see something like what's shown in Figure 9-16. Worst case, you can just manually add the Background and World Output nodes as shown.

image

Figure 9-16: Cycles treats the World like a material, so most of your modifications take place in the Node Editor. This is a simple node network for a World material.

Let's say you're using Cycles and you miss having the Sky & Atmosphere panel that BI's Sun lamp has. You just want to quickly make a sky for your scene. Easily done from the Node Editor! Simply add a Sky Texture node (Shift+A ⇒ Texture ⇒ Sky Texture) and connect its Color output socket to the Color input socket on the Background shader node. And there you have it: a sky. Even better, you don't necessarily need a Sun lamp in your scene like you would if rendering with BI.

Want to use an image texture for your environment? It's a bit of an advanced topic, but you can download high resolution panoramic images from the Internet (even some digital cameras and smart phones have a built-in ability to create panoramic images) and use those as textures for your environment. You just need to add the Environment Texture node (Shift+A ⇒ Texture ⇒ En-vironment Texture) and connect its Color socket to the Color socket of your Background shader node. From there, just left-click the Open button for the image datablock in the Environment Texture node and use the File Browser to find your panoramic image. Cycles will even use the colors from your environment texture to illuminate your scene. You may not even need to use lights at all!

“But what if I just want a simple gradient like I can get in BI's World Properties?” Ironically, getting that effect is less straight-forward in Cycles. A viable cheat (that I've used!) would be to use the compositor and put my render over a gradient background (see Chapter 15 for more on compositing). But let's say you're a purist and you want to do it all in your World material. That, too, is still possible. As an example, use the following steps to re-create the effect of enabling the Blend Sky check box in BI's World Properties (these steps assume you're starting with the simple node network in Figure 9-16):

1. Add a Gradient Texture node (Shift+A ⇒ Texture ⇒ Gradient Texture) and wire its Color socket to your Background shader node's Color input socket.

If you're previewing your scene in the 3D View with Rendered viewport shading (Shift+Z), you should see your background become completely black. That's okay. It's supposed to be like that. The problem is that the default texture coordinates don't map in a way that makes your gradient texture easy to see.

2. Add a Texture Coordinate node (Shift+A ⇒ Input ⇒ Texture Coordinate) and connect its Window socket to the Vector input socket on your Gradient Texture node.

Now you should see your gradient, but there's a problem. The gradient goes from left to right, not vertically. You need to tweak your texture coordinates a bit.

3. Add a Mapping node (Shift+A ⇒ Vector ⇒ Mapping) in-line between your Texture Coordinate node and your Gradient Texture node.

At this point, nothing in your background should be changed. You still have a black-to-white gradient going from left to right. The next step fixes that.

4. In the Mapping node, left-click the Texture button at the top of the node and change the Z rotation value to 90 degrees.

Woohoo! You've rotated your texture and it's looking a lot more like the Blend Sky feature of BI. What you're missing now are controls for the colors in your gradient.

5. Add a ColorRamp node (Shift+A ⇒ Converter ⇒ ColorRamp) in-line between the Gradient Texture node and the Background shader node.

On the face of things, it doesn't appear like much has changed. That's because the default gradient in the ColorRamp node is also black-to-white.

6. Edit the colors on the ColorRamp node to match your desired horizon and zenith colors.

That's pretty much it. But really, with this setup you have even more control than you get in BI because with the ColorRamp node you can control the position of the colors and even add more colors to your gradient. It's incredibly powerful. Figure 9-17 shows an example of what your final node network may look like.

image

Figure 9-17: A node network for mimicking the Blend Sky feature of BI in the Cycles World material.

Creating sky textures in BI

Flat colors, gradients, and procedural stars are nice, but in some cases, you’d definitely rather have an image as your background. You can apply a texture to the World for your scene, like materials and lights. In the preceding section, I cover how easy it is to add a texture to your World material in Cycles.

In BI, applying a texture is actually a little bit tricky to do. Like with texturing materials and lights in BI, you use Texture Properties. What makes things a little complicated is that, if you want to edit textures for your World, you need to first let Blender know the context in which you want to work. To do so, bring up Texture Properties and left-click the World button in the Context panel. The Texture Properties are the same familiar ones that I describe in Chapter 7. The primary difference is in the Influence panel, visible after you add a new texture.

The Influence panel gives you the ability to map the color of the texture to the blend, horizon color, and the upper and lower zenith colors. To use an image as your Sky texture, follow these steps:

1. Left-click the New button in the texture datablock.

This button is located beneath the list box in Texture Properties.

2. Change the texture Type to Image or Movie.

3. In the Image panel, left-click the Open button and use the File Browser to find the image you want to use.

tip You may want to enable thumbnail view from the File Browser’s header.

4. In the Influence panel, map the texture to the horizon color by enabling the check box next to the Horizon slider.

5. Back in World Properties, go to the Preview panel and enable the Real Sky check box.

This step ensures that the sky moves properly (or, more accurately, the sky stays still) as you move your camera in the scene.

6. Switch back to Texture Properties and tweak the mapping and input settings to taste.

You may have to adjust the input coordinates as well as the texture size and offset. It's worth it to play around with these settings a bit to land on the look you want. When you're finished, you may have something that looks like Figure 9-18.

image

Figure 9-18: A simple scene with a sky texture, as well as the World and Texture Properties that set it up.

Understanding ambient occlusion

Take a look outside. Now, hopefully it's daytime, or this example isn't going to work, but notice how much everything seems to be illuminated. Even on a bright sunny day, the deepest shadows aren't completely black. The reason is that light from the sun is basically bouncing off of every surface many times, exposing nearly all objects to at least some amount of light. In computer graphics, this phenomenon is often referred to as global illumination, or GI, and it's pretty difficult to re-create efficiently. As you may have guessed, the biggest reason is the “light only bounces once” rule in BI (see Chapter 7).

Another result of GI is that all this bounced light also makes subtle details, creases, cracks, and wrinkles more apparent. At first, this statement may seem like a paradox. After all, if light is bouncing off of everything, intuitively, it would make sense that everything should end up even brighter and seem flatter. However, remember that not only is the light bouncing off of everything, but it’s also casting small shadows from all the weird angles that it bounces from. Those small shadows are what bring out those minor details.

The GI effect is most apparent outdoors on overcast days where the light is evenly diffused by cloud cover. However, you can even see it happening in well-lit rooms with a high number of light sources, such as an office building with rows and rows of fluorescent lights lining the ceiling. You can somewhat fake this effect in BI by using a Hemi lamp, but the problem with Hemis is that they don't cast shadows, so you don't get that nice, added detail from GI.

The bad news is that the Blender Internal renderer doesn't have “true” GI capability. Cycles, on the other hand, has that capability. So the quickest way to get GI in your scene is to just render with Cycles. However, there are instances where you need to render with BI, so using Cycles isn't an option. Fortunately, BI does have a great way of approximating GI, thanks to ambient occlusion (AO). Often called dirty GI or a dirt shader, AO finds the small details in your object and makes them more apparent by making the rest of the model brighter or making the details darker.

To enable AO in BI, left-click the check box next to the Ambient Occlusion panel in World Properties. When you enable AO, Blender makes the settings in the Gather panel available. This panel gives you two ways of calculating AO: with ray tracing or as an approximation of the result. Figure 9-19 shows the Gather panel with the options for ray traced AO and approximate AO.

image

Figure 9-19: The Gather panel in World Properties with ray traced AO options (left) and approximate AO options (right).

remember If you're going to use ray traced AO, make sure that you have the Ray Tracing check box enabled in the Render panel of Render Properties.

Most of the controls in the Ambient Occlusion and Gather panels are the same, regardless of whether you're using ray traced or approximate AO. Here’s a description of the options available for both types of AO:

· Ambient Color: This color swatch in the World panel controls the source color for the diffuse energy used by AO. The Ambient color adds itself to the overall color of the scene. I don't normally advocate setting the Ambient color to anything other than black because it has a tendency to wash out the shading in the scene. However, when you enable AO and adjust the Ambient color, the shading isn't washed out as much, and you actually end up with a more believable image.

· Factor: The Factor value is the strength of the overall AO effect. The effect you choose from the Add/Multiply menu is multiplied by this value. Usually it's a good idea to keep this at 1.0, although I recommend that you play with it a bit to see how it affects your scene.

· Add/Multiply: With this drop-down menu in the Ambient Occlusion panel, you can control how AO creates shadows. Choosing Add brightens the rest of the object, making the details apparent by simply staying their own color. Choosing Multiply darkens the detailed areas while keeping the object's original shading. Technically speaking, the Add behavior is more physically correct.

· Falloff: This option in the Gather panel controls the size of the extra shadows that AO creates. When you enable the Falloff check box, you can use the Strength value field below it. Setting this value to higher numbers makes the shadows more subtle.

The other values for ray traced and approximate gathering are there for refining and optimizing how they work. If you read about ray traced lights for BI earlier in this chapter in the “Universal lamp options” section, the settings for ray traced gathering are pretty familiar. I recommend using adaptive QMC because it typically yields faster results at good quality. I've even found that in a lot of situations, using ray traced gathering with adaptive QMC sampling is even faster than using approximate gathering. Using the other sampling types usually gives you a noisier, or more speckled, result.

When choosing between ray traced and approximate gathering, keep in mind a set of trade-offs. As you might expect, ray traced gathering gives you more accurate results, but it sometimes takes longer to process when you use a higher Samples value to reduce the noisiness of the AO shading. Approximate gathering works fast and doesn't suffer the noise problem that you get with ray traced gathering. Of course, some people actually prefer that noisy grain that ray traced gathering gives, and approximate gathering is a bit more error-prone in creating its shadows, especially where things touch. So it may take some additional time to set things up so that they look believable. You have to weigh out the advantages and disadvantages for yourself and see which method works best for your projects. Figure 9-20 shows the same scene rendered with both types of gathering, as well as without any AO at all.

image

Figure 9-20: From left to right, with their render times: no AO, ray traced AO, and approximate AO.

remember You can also enable AO in Cycles from World Properties, but the available options are a lot more limited. When you enable AO in Cycles, the only properties for tweaking are a Factor and a Distance value, corresponding to the Factor and Falloff Strength properties in BI's AO settings. Generally, there isn't much call for using AO if you're rendering with Cycles, because Cycles already has GI.

Adding mist in BI

Another panel in World Properties for BI is the Mist panel. The settings in this panel are somewhat primitive in terms of what they actually do, but they can be pretty handy in a pinch for creating nice atmospheric effects and quick backgrounds.

BI's Mist works by decreasing the opacity of objects as they get farther away from the camera, mixing more with whatever the sky is. To use it, enable the Mist check box and expand its panel. From here, you can adjust the Start and Depth values. Start defines how far away from the camera the mist starts to take effect. Depth is the distance from the Start value that the mist effect is at 100 percent. Anything farther away from the camera doesn’t show up in the final render.

tip These values are in the units you specify in Scene Properties, but it can be difficult to know intuitively where they actually fall in the scene, relative to your camera. Fortunately, you can see mist limits visually. Select the camera and switch to Camera Properties. On the left side of the Display panel are four check boxes. Left-click the Mist check box. When you do, a line appears extending from your camera. If you switch back to World Properties and adjust the Start and Depth values, you can now see exactly where the mist region of influence is. And, of course, if you use Rendered viewport shading (Shift+Z), you can see live updates to your render as you adjust values. Figure 9-21 shows a scene in the 3D View with a camera that has its mist limits visible.

image

Figure 9-21: A camera in the 3D View with its mist limits visible. To the right is a render of that scene.

The Falloff drop-down menu controls how the mist gets thicker from start to finish. Quadratic tends to be a more subtle effect, whereas Linear tends to make the mist thicker faster. If you want to limit the mist to a certain height, like when you see an early morning mist in a field, adjust the Height value. Like the other values, Height is set in your specified units and works relative to the XY ground plane. The Intensity value increases the mist's intensity. Be careful with this setting. Putting it too high hides your entire scene from you.

remember There is no Mist panel when rendering with Cycles, so none of the settings covered in this section are available if you've chosen Cycles as your render engine. However, you can still achieve the mist effect if you render with Cycles. You just need to do it in the compositor. There's more on the compositor in Chapter 15.