Lighting

We are now going to look at a very important aspect of the rendering process: the lighting. Without lights, you won't see any objects, as in the real world. Good lighting can be hard to achieve, but it can give a nice atmosphere to the scene. One of the things that is true with a scene with good light is that you won't even notice the lights as they look like natural lighting. In order to get our lighting job done correctly, we are going to add a basic shader to every object in our scene.

Creating a testing material

Let's add a very basic material with Cycles in order to see the effects of the lights. In order to better understand the lights in the next section, we are going to create a blank scene and test our lights on a cube that is laid on a plane:

  1. Let's start by creating a new scene and by adding a plane scaled ten times (S > 10) under the default cube.
  2. We also want to delete the default light and turn the Cycles render engine on.
  3. We aren't going to explore material creation in depth for now, so we advise you to follow these steps in order; later you will have more information about this process. We need to select the cube and open the Material tab of the Properties editor.
  4. Now we will create a new material slot by clicking on the New button.
  5. Under the Surface subpanel, we will click on the color and change its value to 1.0 in order to have a full white color. That's all for the material. It will be a handy material to test the different types of light.
  6. The last thing we need to do is to add the same shader to the plane. To do this, we can copy the material of the cube. We will first select the object (or objects) to which we want to copy the material, in our case, the plane, and then we will select the object that owns the material that we want to copy. Then we will press Ctrl + L and select Material. The plane should now have the same white material.

Understanding the different types of light

The goal of this section is to understand how each type of light can affect our objects in a scene. We will give you a brief explanation and a short preview of what effects they can provide you with:

  1. Before our tests, we will need to change the world shader that contributes to the lighting of the scene. If you press Shift + Z or change the Viewport Shading mode to Rendered in the 3D View header, you can see what the scene will look like, but you will see it in real-time in the viewport. Here you can clearly see the objects even if we don't have any lights. That's because the background color acts as if there was an ambient lighting.
  2. If we go into the world settings of the Properties editor and change the Surface color to black, we will not see anything.
  3. We can now add a light and have a better understanding of its effect without being disturbed by the world shader.

The settings of the lights can be found under the Object Data tab of the Properties editor (a yellow dot with a ray icon) while the light is selected. There are five types of lights (but four work in Cycles) that have many options in common: Size influences the hardness of the shadows they produce on objects and Max Bounces tells Blender the maximum number of bounces the light rays can travel. They also have the ability to cast shadows with the Cast Shadow checkbox turned on. Of course, they also have a strength that you can tweak in the Nodes subpanel. Note that, if you can't see the strength option, you need to click the Use Node button.

Understanding the different types of light

The shared light options

The different types of light are as follows:

  • Point: As its name implies, it emits lights according to its position. It emits light rays in all directions, but these rays are limited to a certain distance from the center of the light. We often call it a spherical lamp.
    Understanding the different types of light

    A point light with a strength of 500 and a size of 0.1

  • Sun: As you can imagine, this type of light represents the way the sun works. As the sun is very far away from earth, we can admit the way we perceive its rays as parallel. So in Blender, the sun produces parallel rays, and we also don't care about its location, but only its orientation matters. With a small size, you can quickly represent the lighting of a bright day. You will mostly use it as a global light as it lights the entire scene. Also, notice that its strength should be less than the point light that we saw previously.
    Understanding the different types of light

    A 45-degree angle on Y and Z sun light with a strength of 2 and a size of 0.05

  • Spot: The spot light is a conic light. It looks like the lamps used on stage in order to light the show presenter. The lighting that it will produce depends on its location, direction, and the spot shape. You can change its shape in the Spot Shape subpanel, and size will determine the size of the circle of light influence. The blend will define the hardness of the circle shadow. The circle size and the strength of the spot light will depend on its distance from the objects.
    Understanding the different types of light

    A 45-degree angle on a Y spot light with a strength of 5000, a size of 0.5, a shape size of 30 degree, and a blend of 0.8

  • Hemi: For now, the Hemi type of light is not supported in Cycles. If you use it, it should react like a sun lamp.
  • Area: This is one of the more common lights. It emits light rays from a plane according to a direction represented by a dotted line. It could be squared or rectangular. Its size, like for the other types, will affect the hardness of the shadows. The strength of the light will also depend on its distance from the objects. With this light, you can achieve a very precise lighting, so we strongly advise you to test this in order to be familiar with the way it reacts.
    Understanding the different types of light

    An area light with a strength of 500 and a square size of 5

Another option that many Blender users appreciate is using an emission shader to act as a light on an object (a plane, for instance). The emission shader is, in fact, the base shader of the other types of lights.

  1. First let's add a plane.
  2. Then, under the Material tab of the Properties editor, we will add a new material slot.
  3. Change the diffuse surface shader from Diffuse BSDF to Emission.
  4. As you may notice, if the plane is in the camera field, you can see it. We don't want this, so go into the Object tab of the Properties editor, and under the Ray visibility subpanel, uncheck Camera.

You may find this easier, but, in fact, with this method we lose a lot of control. The main problem we've found with this method is that we can't control the way the rays are emitted, for instance, with the area light. This can be useful when you want visible objects to emit light, but this is not very good for precise lighting.

Understanding the different types of light

The cube with an emission shader

Lighting our scene

As you can see from the previous part, there are many types of light that we can manipulate in order to achieve a nice lighting effect. But in the case of our haunted house, we are only going to use area and sun lights because the other types of light are often used in specific situations.

  1. We will start by opening our haunted house scene and saving it in another name (HauntedHouseCyles.blend, for instance).
  2. Now we can delete all the lights that we used in the Blender Internal render.
  3. While doing a lighting effect, it's a good to have an idea of the volume of your objects with a neutral material. So we will select one of the objects in the scene, remove its existing material, and create a new material in the Material tab of the Properties editor. As we did for our testing scene, we will change the color value to 1.0.
  4. Rename the material as Clay.
  5. Now we will select all the objects in scene (A), and reselect the object that is the clay material while pressing Shift in order to make it the active object.
  6. Press Ctrl + L and select Material. All objects will now share the same material.
  7. We can now split our interface in two. One of the 3D views will display the camera point of the view (the 0 numpad key) and will be rendered in real time (Shift + Z) with a preview sampling of 50 (decrease it if you don't have a powerful computer).
  8. The first light to be added is the sun. We will orient it, so it lights the right-hand side of the house. It will be nearly horizontal. Our goal here is to have a dawn lighting. The sun has a size of 5 mm in order to have harsh shadows and a strength of 1.0.
  9. The next light that we will add will fill up the front of the house a little bit. It will be an area light that is a slightly tilted down and located on the front left side of the house. We want smooth shadows, so we will change its size to 5 m. Its intensity will be around 400. We can also change its color to be a little bit yellowish.
  10. The last light will act as rim light. It will be an area light that comes from the back of the house on the left-hand side. Its size will be 10 m and its strength around 700. We have also tinted it a little bit towards blue.
    Lighting our scene

    The lighting of the haunted house scene

  11. That's all for the basic lights. The light settings are in constant evolution during the whole image creation pipeline, so don't be afraid to change them according to your needs later. Note that we are missing an environment lighting that we are going to set up in the next part of the chapter.

Painting and using an Image Base Lighting

An Image Base Lighting (IBL) is a very convenient technique that allows us to use the hue and the light intensity of an image to lighten up a 3D scene. This can be a picture of a real place taken with a camera. HDR images provide very realistic results and may be enough to light a 3D scene, but for our haunted house scene, we will paint it directly in Blender with Texture Paint. This technique allows us to do complex lighting in less time and will enrich the lighting that we have prepared previously. We will start by seeing how to prepare the painting phase of a customized IBL:

  1. We will open a new scene in Blender.
  2. We will split the working environment in half with a UV/Image Editor on the right-hand side and a 3D View on the left-hand side.
  3. We will add a UV Sphere at the center of the world (Shift + A and select Mesh | UV Sphere) on which we will paint the sky.
  4. We will delete the vertices at the two poles of the sphere. We will make a scale extrusion (E and S) of the edges and slightly reposition them again for a well-rounded look. We will obtain a sphere pierced on both ends. It is important to have these holes for the UV projection.
    Painting and using an Image Base Lighting
  5. We will select all the polygons of the sphere (A), then we will apply Unwrap Cylinder Projection (U). In the Cylinder Projection options on the left panel (T) of the 3D Viewport, we will change the Direction parameter by selecting the Align to Object option. This allows us to get straight UVs that occupy the most space on the entire UV Square.
  6. Once the UVs are created, we will select the edge loops that form the holes at the poles of the sphere, and we will merge them each in turn to form a complete sphere. This will form triangles in the UV, but it does not matter.
  7. We will again select all the polygons of our sphere, and we will then add a new texture by clicking on the + New button in the UV Image Editor.
  8. In Blender Internal Renderer mode, we will create a new material on which we will place our IBL texture. To better visualize the texture, we will check the Shadeless option (Material | Shading | Shadeless).
  9. In Texture Paint, we can start to paint.
    Painting and using an Image Base Lighting
  10. We will use Fill Brush with the Use Gradient option in order to prepare the gradients of the sky. We will use the following Gradient Colors from left to right. The color marker number 1 on the far left is R: 0.173, G: 0.030, and B: 0.003. The color marker number 2 is located at 0.18, and its color is R to 0.481, G to 0.101, and B to 0.048. The color marker number 3 is at position 0.5, and its color is R to 0.903, G to 0.456, and B to 0.375. The color marker number 4 is located at 0.78, and its color is R to 0.232, G to 0.254, and B to 0.411, and the last marker at the far right is the color R: 0.027, G: 0.032, and B: 0.085. We will then apply the gradient upwards on the sphere.
  11. On the texture in the UV/Image Editor, we can see some black near the poles, which may interfere with the lighting calculation. Thus, in the Paint Mode, we will take the nearest color of the black triangles by pressing the S shortcut (without clicking), and we will fill the black triangles with Fill Brush (without Gradient).
  12. When this is finished, we can save this image as IBL_Sky.
  13. In the Texture Paint mode, in the Slots tab, we will add a Diffuse Color texture that will be transparent this time. For this, we will check the Alpha box, and we will change the alpha value of the default fill color to 1 in the Texture Creation menu. This will allow us to create clouds on another texture while keeping our sky visible.
  14. With the TexDraw brush and the R: 0.644, G: 0.271, B: 0,420 color, we will draw a few clouds. We must think that there will be only the upper half that will be displayed on the framing of the haunted house. This part will have the greatest importance for the lighting. So we must focus on the upper half of the texture.
    Painting and using an Image Base Lighting
  15. We will save the image as IBL_Cloud.
  16. From this cloud texture, we will make a mask that allows us to properly mix the sky and the clouds. For this, we must save our image, with the BW (Black and White) option and not in RGBA, by naming it as IBL_Mask.
  17. We will then return to the haunted house scene, and in the Node Editor, we will click on the World icon that is represented by an earth, and we will check the Use Node option.
  18. We have two nodes that appear: Background and World Output. We will add an Environment Texture node (press Shift + A and select Texture | Environment Texture).
  19. We will duplicate the Environment Texture node twice (Shift + D). We will place them one above the other and to the left.
  20. In each Environment Texture node, we will open the IBL textures created previously.
  21. We will add a Mix RGB node (press Shift + A and select Color | Mix RGB) that will allow us to mix our textures. We will connect the IBL_Sky Color Texture Image Output socket to the Color1 input socket of Mix Shader, the IBL_Cloud Texture Image Color Output socket to the Color2 input socket of Mix Shader, and the IBL_Mask Color Output Socket to the Fac input socket. We will keep Mix as the Blending mode.
  22. We will add a Mapping node (press Shift + A and select Vector | Mapping) that we will duplicate once, and we will position them one above the other on the left-hand side of the Environment Textures node. We will rename them as Mapping_1 and Mapping_2. We will connect Mapping_1 to the IBL_Sky Texture Image node and Mapping_2 to the two other Environment Textures.
  23. We will add a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate) that we will position at the left. We will connect the Generated socket of the Texture Coordinate node to the Vector Input socket of the two Mapping nodes
  24. To get a better contrast for the IBL_Mask, we will place a RGB Curves node (Shift + A and select Color | RGB Curves) between the Environment Texture node and Mix RGB. We will set the following two points: the first point at the X= 0.24 and Y= 0.65 position, and the second point at the X= 0.65 and Y= 0.58 position.
  25. We have all the necessary nodes. To finish, we will need to modify the mapping of the IBL_Sky texture. Therefore, we will modify the X= 6°, Y= 23.9°, and Z= 0° rotation parameters. These values vary according to the painted texture, so adjust them accordingly.
    Painting and using an Image Base Lighting

To visualize your Image Base Lighting (IBL) better, you can display it in the viewport. In the Solid mode, in the right panel of the 3D Viewport, check the World Background option (Display | World Background).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.28.116