essential blender essential blender 11 lighting tutorial

Author: ahmad-musaffa

Post on 30-May-2018




5 download

Embed Size (px)


  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    Chapter 11: Lighting: Tutorial

    By Roland Hess

    While lighting is extremely important to the quality of a final render,[KM] and good setups can run the gamutfrom basic to complex, Blender's lighting tools themselves are simple to use.

    Open the scene called "Lighting Tutorial.blend" that is found in the "lightingexamples" folder of the includedCD.

    The "lighting tutorial.blend" file when first opened.

    If you were to render this scene right now (F12), you would get nothing but a completely blank image.Although the models and textures are complete, nothing will render without lamps.

    Use the toolbox (Spacebar) to add a standard Lamp to the scene.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    The toolbox adding a lamp.

    Like any other Blender object, new lamps are created at the current location of the 3D cursor. They can bemoved (G-key) or rotated (R-key), with the transform manipulators and mouse gestures working as well.salthough scaling should be avoided. In fact, scaling Lamps in Blender can create serious problems withyour scenes., as dDistance, energy and shadow settings can be sensitive to the scene's overall scale of ascene, and using the Scale tools on them can lead to unexpected results. The transformation manipulatorsand mouse gestures will also work with lamps.

    With the new Lamp selected, find the Lamps subcontext of the Shading context, commonly referred to asthe Lamp buttons. In the example file, the buttons window is already set to the Lamp buttons.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    The lamp buttons.

    The type of lamp we you[KM] have added to our your[KM] scene is often referred to as a "point lamp,"[KM],although that term is not used in the Blender interface. A point lamp casts light equally in all directions, usingthe lamp's location as the light source.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    Lamp with arrows showing to how it lightsThe arrows show how light shines in all directions from the

    standard lamp.

    Try a render (F12) to see what the scene looks like with a single point lamp at default settings.

    Note: You can also use the Shift-P preview panel that was demonstrated in Chapter 2 to get a quick fasteridea of how your lamps affect the scene.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    render without shadowsRendering without shadows makes the vase seem to float.

    One thing you'll notice about the render is that while the objects are illuminated on the side facing the lampand dark on the side facing away, there are no cast shadows. You would think that light sources shouldalways cast shadows like they do in the real world. Shadows, however, require extra calculations at rendertime, which can slow things down. In addition, some scenes may have complex lighting setups using dozensof lamps, not all of which need to show shadows for the scene to be believable. For those these[KM]reasons, shadows in most CG programs, Blender included, can be enabled or disabled.

    Let's turn on shadowing for our your[KM] point lamp. In the Shadow and Spot panel, press the "RayShadow" button. Now re-render. That's all there is to using a point lamp.

    Note: If no shadows are rendered after enabling clicking "Ray Shadow,"[KM], be sure that the "Ray" buttonis enabled in the Render panel of the Render buttons (F10).

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    render with shadowsThe vase now looks like it makes contact with the tiles.

    From a top view (Numpad-7), press Shift-D to duplicate the point lamp and move it to the other side of thescene.

    If you have added the wrong kind of lamp to your scene and would like a different kind, you don't need todelete it and create a new one. The Lamps panel in the Lamp buttons lets you switch the actively selectedlamp into a different type. Change the duplicated lamp into a Sun lamp by pressing the "Sun" button on thePreview panel.

    A Sun lamp has the same set of options as a standard Lamp in the Lamp buttons, but works a littledifferently in the 3D view and has a very different effect on a render. Recall that the standard Lampbroadcasts light in all directions from it's[KM] location. A sun lamp does not shine light from a single location,regardless of where the lamp is located in the scene. It creates uniform lighting coming from a singledirection.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    sun lamp in 3D view with arrows showing how light comes from itAll light from a sun lamp flows in the same


    The direction is controlled by the rotation of the lamp in the 3D view, visualized by the dashed line attachedto the lampit. All of the light generated by a Sun lamp will shine parallel to this line. To see the differencebetween the parallel shading and shadows of a Sun lamp and a standard Lamp, move the lamp fairly closeto the vase and orient rotate the lamp's direction tolamp to face it.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    sun lamp close to vase, pointed toward it.[no text]

    Render the scene. With the Render view still up, press the J-key. This will switch the render out to themovethe render to an alternate render buffer, so we you[KM] can easily compare it to the next step.

    Back in the 3D view, change the Sun lamp back tointo a stand standard[KM] lamp and render again.

    When the render is finished, you can press the J-key several times to toggle between the two versions of therender. It's quite obvious when doing this how the light sources differ greatly in their effect, even though theircontrols are mostly the same.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    render of scene as sun lamp and as standardThe sun lamp render is on the left. Even though the lamp isnearly touching the vase, notice the parallel shadows it casts.

    Now that we've introduced you to[KM] the absolute basics of lamps (creation, positioning and shadowactivation), we'll you'll[KM] create two different lamp setups, one each on a different layer, to learn the rest ofthe lamp controls.

    Three Point Lighting

    The discussion section of this chapter talks about some of the weaknesses of this very traditional method,common in studio lighting, but using it will give us you[KM] a good chance to learn some additionaltechniques.

    Three point lighting makes use of... three lamps!. Surprise. One lamp provides a direct light[KM], to show thedetails of the subject (the vase in our the[KM] example). Another lamp shines from a different direction and

    fills in the areas that are cast into shadow by the first lamp. A third lamp shines from behind and above,throwing a bright rim of light around the back and top edges of the subject.

    We'll You'll[KM] start by creating the first light, called the "key" light. Select and delete (X-key) the two lampsthat are already in our your[KM] scene.

    Add a new Spot lamp at about the location shown in the illustration. We've split our 3D view into twoseparate views so you can better see the placement of the lamps.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    spot lamp added for key lightThe 3D cursor positioned before the creation the Spot lamp.

    Using either the hotkeys, the manipulators or mouse gestures, rotate the spot lamp until its central targetingline passes through the vase.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    spot lamp with line passing through vase.[no text]

    Spot lamps have quite a few more controls than the other types of lamps we've you've[KM] seen so far.Almost all of those settings are related to shadows, and we'll examine them in a moment. For now, duplicatethe Spot lamp twice with Shift-D and position and rotate the two new lamps as shown in the next illustration.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    three spot lamps in 3 point lighting configurationSee if you can get close to this lamp configuration.

    A render with this setup produces bland results.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    three lamp render without adjustmentsThree point lighting with three identical lamps.

    What we you[KM] need to do is to adjust the intensities of the lamps to give the image better contrast. SelectSpot number 1, the key light, and adjust the value of the Energy slider on the Lamp panel to around 2. Also,change the R and G values in the RGB sliders to 0.6. As you can see in the color swatch below the slidersand in the Preview panel, this will change the key lamp to a light blue.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    lamp panel showing energy=2 and rg=.6[no text]

    Spot number 2 is called the "Fill" lamp, because it fills in the areas that are not illuminated by the key lamp. Itshould be a more subtle light, so turn its energy down to 0.60, and reduce its Blue slider to 0.5.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    render with energies and colors adjustedA much more interesting render.

    There are a couple of ugly things that are ugly in about this render that can need to be fixed. First, thespecular highlighting from both the fill and back lamps looks bad on the wooden frame of the base, as wellas on the highlight on the left side of the vase. We You[KM] don't want it to lose the highlights from the keylamp, though, so we you[Km] can't just turn off specularity in the vase's material. Blender allows you toenable and disable both specular and diffuse shading on a lamp-by-lamp basis.

    Select the fill lamp (number 2), and click the "No Specular" button on the Lamps panel. Do the same for theback lamp (number 3). You can re-render to see the effects.

    Another problem is the shadow being generated by the back lamp. If you examine it closely in your renderwindow, you can see that it becomes pixelated (boxy) around the edgededges[KM]. In our first experiments,we enabled the "Ray Shadow" button on the standard and Sun lamps. That type of shadow generationalways results in sharp, accurate shadows with no user configuration. Those shadows come at the cost of

    speed. In contrast, the default shadowing method for Spot lamps is called "buffered shadows."[KM].

    Each time an image is rendered using a lamp that has a buffered shadow, a special mini-render is done ofthe scene from the point of view of the spot lamp. An image is created of how far the objects in the sceneare from the lamp. This kind of image is called a "shadow map."[KM]. When the final render is done, thatshadow map is used to decide if there is anything between the part of the object being render rendered[KM]and the[KM] lamp, creating shadows.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    If you're thinking ahead, you may already realize why the shadow being generated by the back lamp lookspixelated. . It's because the shadow map, being an image, doesn't have enough resolution (enough pixels)to cover the area of the scene it is being asked to cover.

    We You[KM] can control the size of the shadow map with the "ShadowBufferSize" spinner in the Shadowand Spot panel. Select the back lamp and set its ShadowBufferSize to 2000. Re-render to see the shadowfrom the back lamp with a much nicer edge this time.

    There is one other huge problem with the shadow from that back lamp, one you may not have even noticed:there seems to be light leaking through the vase!

    fixed shadowbuff size, but highlighting light leakSome problems have been cleaned up, but light is bleedingthrough the vase.

    Where is that coming from? Without being too technical, we'll just say that at some point during the creation

    of the shadow map, the wall of the vase was too thin to be detected. The result is an inaccurate map and abad render. To fix problems like this, turn the Bias setting on the Shadow and Spot panel to 0.3. Re-render,and the problem has gone away.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    fixed render.Much better.

    You might be thinking at this point that tweaking buffered shadows is a pretty big pain and wondering whyyou shouldn't just use ray shadows all the time. The first reason is speed, and the second is flexibility. If youlike, note your render time for using buffered shadows on the Render window. Then, switch each of thelamps to use ray shadows, re-render and see the time difference. On my the[KM] test computer for thissimple scene, the difference is that buffered shadows are almost 20% faster than ray shadows.

    The second advantage, and probably the most important, is flexibility. Buffered shadows allow you to easilycreate blurred shadows, which can give an image a softer, more realistic look. To show this effect, set theSoft value of the back lamp to 10 and re-render. To increase the quality of the softening calculations, youcan raise the Sample value.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    soft shadowingThe back light's shadow, softened.

    Callout: When working with buffered shadows, there are several things to watch out for:- PIxelated Pixelated[KM] (blocky) shadows can be fixed by raising the ShadowBufferSize.- Light leaks in a shadow, as well as a shadow not quite meeting the bottom of the shadow- casting[KM]object, can be fixed by reducing the Bias value.- Buffered shadows can be blurred by raising the Soft value.

    There are two more things we you[KM] can do to increase the quality of our your[KM] buffered shadow. Thefirst is to adjust the Spot lamp's cone that you can seeappears in the 3D view. The cone that emanates fromthe lamp shows the area of light that is projected. Nothing outside of this cone receives any light from thelamp. You Your[KM] goal as a lighting technician in Blender is to get that cone to be as small as possible,while still encompassing the objects in your scene.

    Adjust the area the spotlight covers by reducing the SpotSi (Spot Size) slider on the Shadow and Spot

    panel. In the case of our the[KM] example, I waswe were[KM] able to reduce it to 15.00. Note in theillustration how much smaller the cone is than before.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    smaller light coneTry to achieve the tightest light cone that will cover your objects.

    The second adjustment that can assist with spot quality deals with something called clipping. Clipping is justanother way to limit what the shadow buffer creator creation process sees. The defaults that you can see atthe bottom of the Shadow and Spot panel are 0.50 for ClipSta (Clip Start) and 40.00 for ClipEnd. Thismeans that Blender will create a shadow map for objects that are between 0.50 and 40.00 units from thelamp. Nothing outside of that range will be able to cast a shadow. Like the size of the Spot lamp's cone, weyou[KM] want to keep this range as small as possible while still encompassing all of the objects that need tobe included.

    The newest version of Blender allows you to set this the clipping values automatically. To do so, click the"Automobile" button (Get it? Auto?) to the left of each Clip spinner on the panel.

    In a rudimentary scene like our this[KM] example, none of these optimizations make much of a difference torendering speed or quality. It is when scenes grow in complexity, to hundreds of thousands of faces, and arerendered thousands of times for an animation that these controls really begin to prove their worth.

    One final word about buffered shadows. If all of these settings seem overwhelming, but you want the speedof buffered shadows, you are in luck. In addition to the default method of buffered shadow creation (called"Classic-Halfway" for technical reasons), there is another method called "Irregular."[KM].

    Select the key lamp (number 1) and change the drop down menu below the "Buf. Shadow" button to"Irregular."[KM]. The ShadowBufferSize and several other controls disappear. Irregular shadow buffers give

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    very nice edges without the downsides of raytracing. Adjust the Bias on this lamp to 0.300 and turn on Autoclipping for both ClipSta and ClipEnd.

    Final render with 3 three point lighting setup.

    That's a decent lighting setup for our your[KM] scene. We'd like you[KM] to make one more, but we'veyou've[KM] spent so much time on this one that it seems wrong to completely discard it. Rather, we'd justlike you[KM] to get it out of the way. Select all three lamps, then press the M-key, which, if you remember forfrom the Object chapter, will bring up the Layers palette.

    Use the mouse, or press the 2-key, to put the lamps on Layer 2. Unless they are on a visible layer, lampswill not add light to a scene. Therefore, using layers to hold different sets of lamps is a great way to managedifferent lighting setups.

    With those lamps sent to Layer 2, let's create a new lamp directly above the scene. This time, select the

    "Hemi" style of lamp from the toolbox. If you create the lamp in a top view, it will be facing directly downward.If it isn't, use Alt-R to remove any rotations.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    new hemi lamp, arrowsThe Hemi lamp illuminates from an imaginary hemisphere.

    The purpose of a Hemi lamp is to light every object in the scene as though it were in the middle of a giant,glowing hemisphere. Hemi lamps are like Sun lamps in that their location doesn't matter -[KM]-- only theirorientation. Hemi lamps do not cast shadows.

    Here is a render of the scene with the Hemi lamp's default settings.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    hemi lit scene. The scene lit with a single Hemi lamp.

    Obviously, Hemi lamps aren't really suitable by themselves. They are good, however, for adding a little bit oflight to a scene whose shadowed areas appear too dark, or to give an overall color cast.

    Since we'll you'll[KM] be using it as a sort of background illumination, let's reduce it's Energy slider to around0.4, and turn off specularity by pressing the "No Specular" button.

    Now, we'll you'll[KM] add the last kind of lamp:[KM], an Area lamp. Create one with the toolbox, and positionit as shown in the illustration.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    area lamp added[no text]

    Area lamps are directional, so we you[KM] will need to point it at the vase. The fastest way to do this is tofirst select the Lamp, then Shift-RMB select the vase and press Ctrl-T. Choose "TrackTo Constraint" fromthe menu that pops up. Ctrl-T tells the selected object to point toward the Active object, regardless of whereit is. A lamp that is tracked this way will even automatically follow an animated object.

    With the Area lamp as the Active object again, enable "Ray Shadow" in its Shadow and Spot panel. Turn"Samples" up to 4 once Ray Shadow is on. Set Energy to 0.25.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    area lamp settings[no text]

    When you render, you should see something like this:

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    area lamp render[no text]

    Notice the softening shadows? Although it uses raytracing to calculate the shadows, they aren't sharp. Whynot? An Area lamp simulates what would happen of if[KM] you had a grid of ray-traced Sun lamps. TheSample spinner tells the Lamp how many raytraced lamps to include in its calculations. In this case, thevalue we you[Km] assigned, 4, told it to make a grid that was 4 lamps by 4 lamps, giving a total of sixteenlamps.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    faked sun lamps, with renderThe render from a grid of Sun lamps is similar to that of the Area lamp.

    Here, you can see a real Sun lamp arrayed on a 4x4 grid. The resulting render looks much the same as theone from the Area lamp.

    Area lamps can give a realistic effect with respect to shading and shadowing, but it comes at a cost.Because it istheytheir shadows are[KM] raytraced, it rendering[KM] can be slow. As the Samples valueincreases, quality goes up, but speed suffers.

    Another issue with Area lamps is that distance from the subject can be important. They are tuned for optimallighting conditions at the distance noted in their Dist control on the Lamp panel. This value is shown by thecentral targeting line extending from the lamp in the 3D view. Moving a lamp much closer or further from thesubject than its distance value suggests can result is drastically increased and reduced energy levels,respectively.

    Before we move on to the final method of lighting a scene, we'll add one more trick to our your[KM] lampknowledgelook at one more technique. Although we'll you'll[KM] do this to the Area lamp, it will work for anyof Blender's lamp types.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    The Lamp tTexture and iInput panel.

    On the Texture and Input panel in the Lamp buttons, use the menu selector below the Add New button tofind the texture called "Branches."[KM]. Then click on the "View" button below the texture selector to changethe way the texture maps with the light. Lamps can have standard Blender textures attached to them., andtThose textures can be used to change the color of the light. One of the best uses for this is to fake the waythat light filters through a tree's branches and leaves.

    Of course, you could also model an actual tree with leaves, and have the lamp shine through it, casting realshadows. But most times, going to such trouble will not be worth the difference in the resulting renders.

    Render again, and see how the Branches texture affects the light.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    branches renderThe branch pattern of the image texture is cast from the lamp.

    The Branches texture was already created for you, but you can use any of the texturing tools reviewed in theMaterials and Texturing chapter to create textures for your lamps. They can be layered, just like Materials,and their scales and offsets adjusted and animated separately. For example, if you wanted to make a fairlyconvincing animation of a branch shadow pattern moving in the wind, you could create three different branchtextures, stack them, and animate them each to move in a slightly different way. While that probably wouldn'thold up if it were the featured portion element of a scene, it would certainly suffice for background work.

    At this point, you can push the Clear button to remove the texture from the lamp.

    In addition to lamps, Tthere is one more method of adding light to a scene. It produces excellent results, butcan be slow. Do you see a trend here?

    Ambient Occlusion

    Select and delete the Hemi lamp we you[KM] created earlier. Select the Area lamp and send it to Layer 3 toget it out of the way for a moment.

    Find the World buttons (F8), which are another subcontext of the Shading buttons, like Lamps. Click on the"Amb Occ" tab to bring it to the front. Ambient Occlusion refers to a technique that raytracing renderers canuse that causes faces that are both near and pointing at toward other faces to appear darker, and faces thatare far, or pointing away from, other faces to appear lighter. To see the effect in practice, click on the"Ambient Occlusion" button in the Amb Occ tab, then render.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    amb occ tab with settingsDefault Ambient Occlusion settings.

    The render is grainy, but notice how the tiles under the vase have a subtle shading to them, which makes itlook like the vase is casting a slight shadow. Also, the lower portion of the vase is darker than the top, as itslower[KM] faces are pointing toward the tiles, while the faces on the upper part are facing the "sky."[KM].And all of this with no lamps! This method of lighting a scene can be excellent when you want believabilitywith very little configuration and have rendering time to burn.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    amb occ render with default settingsA render lit only with Ambient Occlusion.

    Raising the Samples value for Ambient Occlusion smoothes out the graininess, but, of course, takes longer.It's quite common to work on a scene that will include Ambient Occlusion with a very low sample value, like2, to enhance speed for[KM] while you get things as you want themtweak the rest of the scene. After that,you can turn it up to 10 or so for your final render and get yourself a cup of coffee.

    To demonstrate how believability in an image can be significantly enhanced by using Ambient Occlusion(often usually referred to as "AO"), let's bring back our Area lamp. Enable Layer 3 (by Shift-LMB on theLayer 3 button on the 3D header, or by using Shift-3), and render). Since the AO is already adding asignificant amount of light to the scene, turn the Area lamp's Energy slider even further down to 0.1. Render.

    The result is a softly lit scene with a high degree of believability. If you would like to really remove the grainin the render, change the AO samples to 10 and check the new result. AO samples can be set as high as16, but excellent results are usually achievable without going that far.

  • 8/14/2019 Essential Blender Essential Blender 11 Lighting Tutorial


    final renderThe final render.


    Lighting is an art form in itself. Large CG companies have artists on staff who do nothing but lighting. It is acomplex topic , one that can make or break a scene. While we've shown you the mechanics of usingBlender's lighting tools in this tutorial, we encourage you to work through the discussion section of thischapter, and to seek out other resources to enhance your artistic abilities.