|Read more about this book|
Getting the right files
Before we get started, we need a scene to work with. There are three scenes provided for our use—an outdoor scene, an indoor scene, and a hybrid scene that incorporates elements that are found both inside as well as outside. All these files can be downloaded from http://www.cgshark.com/lightingand-rendering/
The file we are going to use for this scene is called exterior.blend. This scene contains a tricycle, which we will light as if it were a product being promoted for a company.
To download the files for this tutorial, visit http://www.cgshark.com/lighting-and-rendering/ and select exterior.blend.
Blender render settings
In computer graphics, a two-dimensional image is created from three-dimensional data through a computational process known as rendering. It's important to understand how to customize Blender's internal renderer settings to produce a final result that's optimized for our project, be it a single image or a full-length film. With the settings Blender provides us, we can set frame rates for animation, image quality, image resolution, and many other essential parts needed to produce that optimized final result.
The Scene menu
We can access these render settings through the Scene menu. Here, we can adjust a myriad of settings. For the sake of these projects, we are only going to be concerned with:
- Which window Blender will render our image in
- How render layers are set up
- Image dimensions
- Output location and file type
The first settings we see when we look at the Scene menu are the Render settings. Here, we can tell Blender to render the current frame or an animation using the render buttons.
We can also choose what type of window we want Blender to render our image in using the Display options.
The first option (and the one chosen by default) is Full Screen. This renders our image in a window that overlaps the three-dimensional window in our scene. To restore the three-dimensional view, select the Back to Previous button at the top of the window.
The next option is the Image Editor that Blender uses both for rendering as well as UV editing. This is especially useful when using the Compositor, allowing us to see our result alongside our composite node setup. By default, Blender replaces the three-dimensional window with the Image Editor.
The last option is the option that Blender has used, by default, since day one—New Window. This means that Blender will render the image in a newly created window, separate from the rest of the program's interface.
For the sake of these projects, we're going to keep this setting at the default setting—Full Screen.
These are some of the most important settings that we can set when dealing with optimizing our project output. We can set the image size, frame rate, frame range, and aspect ratio of our render. Luckily for us, Blender provides us with preset render settings, common in the film industry:
- HDTV 1080P
- HDTV 720P
- TV NTSC
- TV PAL
- TV PAL 16:9
Because we want to keep our render times relatively low for our projects, we're going to set our preset dimensions to TV NTSC, which results in an image 720 pixels wide by 480 pixels high. If you're interested in learning more about how the other formats behave, feel free to visit http://en.wikipedia.org/wiki/Display_resolution.
These settings are an important factor when determining how we want our final product to be viewed. Blender provides us with numerous image and video types to choose from.
When rendering an animation or image sequence, it's always easier to manually set the folder we want Blender to save to. We can tell Blender where we want it to save by establishing the path in the output settings. By default on Macintosh, Blender saves to the /tmp/ folder.
Now that we understand how Blender's renderer works, we can start working with our scene!
Establishing a workflow
The key to constantly producing high-quality work is to establish a well-tested and efficient workflow. Everybody's workflow is different, but we are going to follow this series of steps:
- Evaluate what the scene we are lighting will require.
- Plan how we want to lay out the lamps in our scene.
- Set lamp positions, intensities, colors, and shadows, if applicable.
- Add materials and textures.
- Tweak until we're satisfied.
Evaluating our scene
Before we even begin to approach a computer, we need to think about our scene from a conceptual perspective. This is important, because knowing everything about our scene and the story that's taking place will help us produce a more realistic result.
To help kick start this process, we can ask ourselves a series of questions that will get us thinking about what's happening in our scene. These questions can pertain to an entire array of possibilities and conditions, including:
- What is the weather like on this particular day? What was it like the day before or the day after?
- Is it cloudy, sunny, or overcast? Did it rain or snow?
- Source of light
- Where is the light coming from? Is it in front of, to the side, or even behind the object?
- Remember, light is reflected and refracted until all energy is absorbed; this not only affects the color of the light, but the quality as well. Do we need to add additional light sources to simulate this effect?
- Scale of light sources
- What is the scale of our light sources in relation to our three-dimensional scene? Believe it or not, this factor carries a lot of weight when it comes to the quality of the final render. If any lights feel out of place, it could potentially affect the believability of the final product.
The goal of these questions is to prove to ourselves that the scene we're lighting has the potential to exist in real life. It's much harder, if not impossible, to light a scene if we don't know how it could possibly act in the real world.
Let's take a look at these questions.
- What is the weather like? In our case, we're not concerned with anything too challenging, weather wise. The goal of this tutorial is to depict our tricycle in an environment that reflects the effects of a sunny, cloudless day. To achieve this, we are going to use lights with blue and yellow hues for simulating the effect the sun and sky will have on our tricycle.
- What are the sources of our light and where are they coming from in relation to our scene? In a real situation, the sun would provide most of the light, so we'll need a key light that simulates how the sun works. In our case, we can use a Sun lamp. The key to positioning light sources within a three-dimensional scene is to find a compromise between achieving the desired mood of the image and effectively illuminating the object being presented.
- What is the scale of our light sources? The sun is rather large, but because of the nature of the Sun lamp in Blender, we don't have to worry about the scale of the lamp in our three-dimensional scene. Sometimes—more commonly when working with indoor scenes, such as the scene we'll approach later—certain light sources need to be of certain sizes in relation to our scene, otherwise the final result will feel unnatural.
Although we will be using a realistic approach to materials, textures, and lighting, we are going to present this scene as a product visualization. This means that we won't explicitly show a ground plane, allowing the viewer to focus on the product being presented, in this case, our tricycle.
|Read more about this book|
Planning our light rig
Knowing that our scene has the potential to really exist somewhere in the real world, we can now plan how we want to set up our lamps within Blender to produce a realistic result.
The first step in this process is to choose an appropriate light rig. Think about the mood we want to create and the environment our scene contains—do we need harsh lighting with sharp shadows, or maybe something more evenly lit? Once we know what we want, we can choose between any of the light rigs. Remember, these options include:
- 1-Point light rig
- 2-Point light rig
- 3-Point light rig
- 4-Point light rig
Sometimes, we'll light scenes that require a combination of light rigs. If that's the case, try to imagine how lights would be set up in a real situation to create the effect we want to reproduce.
We should also think about what lamps we should use in our rigs. Remember, each lamp type in Blender has its own unique qualities and will simulate some types of real-world light sources better than others will. The types we can choose from are:
- Point lamp
- Sun lamp
- Spot lamp
- Hemi lamp
- Area lamp
For this particular scene, we are going to use a 3-Point light rig. If needed, we'll add a fourth later. The 3-Point light rig is appropriate for two main reasons:
- This is an outdoor scene. In a natural setting, light would be illuminating our object from every angle. The 3-Point lighting rig can simulate this phenomenon, and when properly set up, will effectively illuminate our object without a problem.
- We are promoting a product, in our case, a tricycle. When working with scenes of this nature, it is a good practice to light objects from multiple angles to best advertise the product or service being advertised.
In addition, fill and rim lights will help increase the perceived dimensionality of our three-dimensional objects, simulating the effect of light reflection and refraction.
Setting up our scene
We've conceptually developed our scene and created a light setup that will realistically reflect how our tricycle could possibly be lit in the real world. Now we can open our three-dimensional file and physically begin positioning lamps in Blender.
This is where our knowledge of color theory will come in handy. For example, if our scene takes place in a park, we may use blue, yellow, and green hues to reflect the color of light given off by the sun, sky, and grass.
On the other end of the scale, if our scene takes place in a dark setting, such as a bar, we may choose to use colors like red, brown, green, and/or purple to simulate the colors created by the wood of the bar itself, the colors of the bar stools, or the colors of the neon sign flashing in the window. You may even include a blue light to simulate the flickering street lamp across the street.
When you open your scene for the first time, you should see something similar to the following image. If you don't, make sure you download the right file from the website http://www.cgshark.com/lighting-and-rendering/.
Setting up a 3-Point light rig
Earlier, we decided we wanted to use a 3-Point light rig. Let's review this quickly. A 3-Point light rig consists of three light sources:
- Key light
- Fill light
The fill light is placed to the side of the object, typically on the opposite side of the camera that the key light is on. Aimed toward the three-dimensional objects being illuminated, the purpose of the side light is to lighten some of the dark shadows and increase the perceived dimensionality of the three-dimensional object.
The backlight, or rim light, is important because its purpose is to create a sharp highlight on the edges of our three-dimensional object, forcing it to pop away from the background. This lamp is placed behind our object, opposite our camera. For best results, we should find a happy medium between the three-dimensional object and our camera to aim this lamp.
The key light is positioned next to the camera, that is, at the same distance from the three-dimensional grid and slightly to either side. In most cases, as in ours, the key light is aimed in the direction of the three-dimensional object, or objects, being lit.
Because the majority of the light that is used to light our tricycle will be coming from the sun, we can start constructing the 3-Point light rig with a sun lamp.
- In Blender, add a Sun lamp by selecting Add | Lamp | Sun.
- Using either the G-hotkey or the Transform Widget, move the lamp so that it is just to the left of the camera.
- Rotate it using either the R-hotkey or the Rotation Widget, so that it's aimed in the direction of the tricycle.
- Give it a slight downward angle by rotating it along the horizontal axis (the local X axis). This will simulate the sun illuminating the tricycle from above.
- If you render it out (Render | Render Image or the F12 key), you should get something similar to the following image:
If you are a Macintosh user, you may have to press fn + F12 to render the image properly. This bypasses the default Apple commands preprogrammed into the operating system.
Adjusting the lamp color
Remember that the sun lamp not only simulates the luminosity of the object, but the color as well. In order to change the various values associated with lamps in Blender, we need to take a look at the Lamp menu.
The Lamp menu
This menu button can be toggled between the Lamp menu and the Material menu, based on the type of object selected. If a lamp was selected, the Lamp menu would become active, and vice versa if a mesh was selected. Making sure our key light is selected, we can now access the Lamp menu.
To better simulate light coming from the sun, we need to change the color that the key light produces to something comparable to natural sunlight. In our case, we can change the color to a slight yellow hue.
- Click on the rounded rectangle found in the Lamp settings to bring up the color picker.
- Change the value to a slight yellow color—refer to the following image for guidance:
- When you're happy with the color selection, move the mouse off the color picker to close it:
- Change the value to a slight yellow color—refer to the following image for guidance:
Although our tricycle is in a three-dimensional medium, the render looks rather flat. This is partly due to a lack of shadows in our scene. Shadows have an amazing effect on a scene, as they can secure an object to the ground or push it up into the air. They can add another indicator of dimensionality to the three-dimensional object in the scene.
By default, Blender doesn't enable shadows. We have to explicitly tell the program to calculate them for our scene. Under the Lamp menu, there is a section for the Shadow settings, which is found directly underneath the Lamp settings we just adjusted.
To enable shadows, you need to select the Ray Shadow radio button. This activates the shadow parameters, as we saw in the previous image. For now, leave these settings as they are, we'll play around with them later. Rendering out your scene now should result in something similar to the following image. If something doesn't seem right, go ahead and adjust some settings to fix it. When you're set, we can move on to add more lamps to our scene.
Adding a fill light
The next light to add is the fill light. In most cases, the fill light is found on the opposite side of the camera that the key light is on. In our case, we are going to use a Hemi lamp placed above the tricycle, simulating the light coming from the sky.
- Add the Hemi lamp, and using either the G-hotkey or the Transform Widget, position the lamp above the tricycle by constraining it along the vertical z-axis.
Constraining along axes
There are two approaches to constraining a transformation along a particular axis. If you use the G-hotkey, you can constrain the object by pressing the X key, Y key, or Z key to constrain along the x, y, and z axes, respectively. To constrain using the Transform Widget, selecting one of the colored arrows will automatically constrain the transformation to that particular axis.
- Change the color of the lamp to a sky blue and change the Energy to 0.5. This should result in an image similar to the following one:
Adding dimensionality with a backlight
The final light we need to add to complete our 3-Point light rig is the backlight, or rim light. The goal of this light is to add a strong highlight along the edges of our three-dimensional object, forcing it to pop away from the background.
- Add another Sun lamp.
- Position it using the G-hotkey or the Transform Widget so that the lamp is behind the triangle and opposite the camera.
- Rotate it using the R-hotkey or the Rotation Widget so the light barely grazes the top of the tricycle (refer to the following image).
If we leave the rim light as is, it will wash out the shadow on our ground plane. To fix this, we need to move it to the first layer. With our rim light selected, enable the This layer only checkbox to tell it to only light the tricycle on the first layer.
Good habits start early
The position of the Sun lamp has no effect on the way in which the image is rendered; Blender is only concerned with its angle. Why, then, are we moving the Sun lamps to these places in our scene? It may seem like extra work, but it serves more than a conceptual purpose. First, it gets us into the habit of moving our lamps around to where we imagine the source of light is coming from. Remember, some lamps do depend on the position of the lamp, such as the Spot lamp. Doing this habit with all the lamps puts us into the habit, so we don't confuse ourselves later.
Continue to play around with the lamp settings and colors until you're satisfied with the result. Try new things and see what happens. It's surprising how many cool effects you find when you make a mistake.
Here is the final render we should have after lighting this scene. Once you have a result you're happy with, we can start adding materials and textures!
We've talked a lot about establishing and sticking to a workflow. This is very important when working professionally. An effective workflow can increase your productivity. We've also asked ourselves a lot of questions about our scene so that we can understand what's happening in our scene better. It's almost impossible to light a scene if we don't understand what's going on. These questions are aimed at guiding us and giving us a better understanding about where our scene is coming from, and it is at the moment we want to portray, and where it's going. If we can imagine that our scene has the potential to exist somewhere in the real world, then it will be a lot easier to produce a realistic result.
- What is the weather like?
- Where is the light coming from?
- What is the scale of these light sources in relation to our three-dimensional scene?
Using Blender's lamps, we were able to successfully simulate how our tricycle would look on a sunny, cloudless day. We also discussed:
- Applying a 3-Point light rig to our scene
- Adjusting the color of the lights to better reflect the sources they were intended to simulate
- Adding shadows to our scene to increase the credibility of the final render
- Using layers to better control the lighting in our scene