In this recipe, we will see how to create a mesh-light material to be assigned to any mesh object and used as a source to light the scene.
Until now, we have used the default Lamp (a Point light) already present in the scene to light the scene. By enabling the node system for the Lamp, we have seen that it uses a material created by connecting an Emission node to the Lamp Output node.
The good news is that just because it's a material node, we can assign an Emission shader to a mesh, for example, to a Plane conveniently located, scaled, and rotated to point to the scene that is the center of interest. Such a light-emitting mesh is called a mesh-light. Being a mesh, the Emission shader node output must be connected to the Surface (or the Volume) input socket of a Material Output node instead of the Lamp Output node.
Light emission coming from a surface and not from a point is a lot more diffused and softer than the light from a Lamp. A mesh-light can be any mesh of any shape, so it can be used as an object taking part in the scene and be the real light source of the rendering at the same time, for example, a table lamp, or a neon sign, or a television screen. As a pure light-emitting Plane, it's usually used as a sort of photographic diffuser. Two or three strategically placed mesh-lights can realistically simulate a photo studio situation. To replace the Lamp with a mesh-light, Plane perform the following steps:
start_07.blend
file, click on the eye icon of Lamp in the Outliner to enable its visibility again.Emitter
.start_09.blend
.Now let's create the emission material and also take a look at the setup for the softness of the projected shadows:
Emitter
.0.800
) and set the Strength slider to 25.000
.The situation so far is as follows:
2.500
.start_10.blend
. Now look at the softer shadow, as shown in the following screenshot:450.000
.start_11.blend
. Look at the crisper shadow in the Rendered preview, as shown in this screenshot:From steps 5 to 7, we saw how a mesh-light can be scaled bigger or smaller to obtain a softer (in the first case) or a sharper (in the second case) shadow, respectively. The Strength value must be adjusted for the light intensity to remain consistent, or the mesh-light must be moved closer or more distant from the scene.
Scaling the mesh-light is basically the same as setting the size value for a Lamp. For Lamps, the softness of shadows can be set by the Size value to the left of the Cast Shadow option in the Lamp window, under the Properties panel (by default, the Size value is set to 1.000
). At a value of 0.000
, the shadow is at its maximum crispness, or sharpness. If the Size value is increased, the softness of the shadow increases too.
Unlike the mesh-light, varying the Size value of a Lamp doesn't require us to adjust the Strength value to keep the same light intensity.
In several cases, you might not want the emitters to appear in your rendering. There are node arrangements to accomplish this (such as using the Light Path node in a way quite similar to the Setting the World material recipe we have seen before), but the easiest way to do this is as follows:
start_11.blend
) and put the mouse cursor on the orthogonal 3D view to the left of the screen. Press the 3 key to navigate to the Side view. Then press Shift + Z to go in the Rendered mode to also see the Emitter plane rendered (be warned that if your computer can't easily render two windows at the same time, you must temporarily turn off the rendering for the Camera view).When you disable any one of the items, the corresponding property won't take part in the rendering. In our case, when the Camera box is unchecked, the mesh-light won't be rendered but it will still emit light. Be careful that the Emitter plane is not renderable at this moment, but because all the other items in the tab are still checked, it can be reflected and could cast its own shadow on other objects.
Now the Spheroid has disappeared, but it's still casting its shadow on the floor Plane, as shown in this screenshot:
start_12.blend
. Let's try tweaking this a little.start_13.blend
.Of course, the Ray Visibility trick we've just seen is not needed for Lamps because a Lamp cannot be rendered at all. At the moment, only Point, Spot, Area, and Sun lamps are supported inside Cycles. Hemi lamps are rendered as Sun lamps.
Both Lamps and mesh-lights can use textures too, for example, project colored lights on the scene, but only a mesh-light can be unwrapped and UV-mapped with an image map.
One advantage Lamps have over mesh-lights is that they can be made unidirectional easily, that is, apart from Point lamps, they cast light in only one direction. The following screenshot shows the casting of light with a Spot Lamp:
In the preceding screenshot, you can see that only the Plane and the Spheroid in front of the Spot lamp receive light. With a mesh-light plane replacing the Spot lamp, objects in both the front and the back (the half-cylindrical Wall and the second Spheroid) receive light.
What if we want to light the object in only one direction (Plane and Spheroid in front) with a mesh-light? Is there a way to make a light-emitting plane emit light only from one side and not the opposite side? Yes, there is; follow these steps:
01_meshlight.blend
file, which has prepared the scene used for the preceding screenshots, and be sure to enable only the first and the seventh layer.01_meshlight_final.blend
.We have already seen that in a Mix Shader node, the first (upper) green Shader input socket is considered equal to a 0
value, while the second socket is considered equal to a 1
value. So, the Backfacing output of the Geometry node is telling Cycles to make the mesh-light plane emit light only in the face-normal direction, and to keep the opposite back-facing side of the plane black and non-emitting (just like a blank shader).
By switching the Emission node connection to the first Mix Shader input socket, it's obviously possible to invert the direction of the light emission.
18.227.81.153