In this recipe, we will see how to create a mesh-light material to be assigned to any mesh object and used as source light to light the scene.
Until now we have used the default lamp (a Point light) already present in the scene for lighting the scene. By enabling the node system for the lamp, we have seen that the lamp uses a material created by connecting an Emission node to the Lamp Output node.
The good news is that, exactly because it's a node material, we can assign an Emission shader also to a mesh. For example, to a plane conveniently located, scaled, and rotated to point to the scene. Such a light emitting mesh is called a Mesh-light. Being a mesh, the Emission shader node output must be connected to the Surface input socket of a Material Output node instead of the Lamp Output node.
The light emission, coming from a surface and not from a point, is a lot more diffuse and softer than a lamp. A mesh-light can be any mesh of any shape and, therefore, can be easily used as an object taking part in the scene and being, at the same time, the real light source of the rendering—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 mesh-lights strategically placed can realistically simulate a photo studio situation.
start_07.blend
file, click on the eye lamp icon in the Outliner to enable it again.start_09.blend
.start_10.blend
.start_11.blend
.From step 5 to step 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. 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 basically is the same as setting the size value for a lamp. For lamps, the softness of the shadows can be set by the Size value on 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. By increasing the Size value, the softness of the shadow increases too.
Differently from 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 would want the emitters to not appear in your render. There are node arrangements to accomplish this (by using the Light Path node in a very similar way to the Setting the World material recipe we have seen before), but the easiest way to do this is as follows:
start_11.blend
) with the 3D window on the left also set to the Rendered mode, to see the scene out of the Camera view (so the Emitter plane is rendered too).By checking any one of the items, the corresponding property won't take part in the rendering. In our case, by unchecking the Camera box, the mesh won't be rendered, although still emitting light. Be careful that, at this moment, the Emitter plane is not renderable but, because all the other items in the tab are still checked, it can be reflected, and if this is the case, can cast its own shadow on the other objects.
Now the spheroid has disappeared, but it's still casting its shadow on the plane, as shown in the following screenshot:
start_12.blend
. Let's try tweaking this a little..hdr
image, which we had formerly set in the World material.start_13.blend
.The Ray Visibility trick we've just seen, of course, is not needed for lamps, because a lamp cannot be rendered in any case. 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 to, for example, project colored lights on the scene, but only a mesh-light can be unwrapped and UV mapped with an image map.
More, it seems that mesh-lights work better than lamps in Cycles, that is, the light casting and diffusion looks better and more realistic with an emitting plane. It's not clear if this is just a technical lamp limitation or if it will be improved in the future.
One advantage lamps have on mesh-lights is that they are easily made unidirectional, that is, apart from Point lamps, they cast light in only one direction, as shown in the following screenshot:
In the preceding screenshot, you can see that only the plane and the sphere in front are lit by the Spot lamp. With a mesh-light plane replacing the Spot lamp, instead, both the sphere and the cylindrical green wall behind are lit, as shown here:
So what if we want to only light the object in one direction (plane and sphere in front) with a mesh-light? Is there a way to make a light-emitting plane to emit it only from one side and not the opposite one? Yes, of course, there is:
1301OS_01_meshlight.blend
file, which has a prepared scene similar to the one used for the preceding screenshots, and set the bottom 3D window to the Rendered mode by clicking on the Viewport Shading button in the header and selecting the upper item.1301OS_01_meshlight_final.blend
.The plane is now emitting light only in one direction.
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 one to a 1
value. So, the Backfacing output of the Geometry node is stating Cycles to make the plane emit light only in the face-normal direction, and to keep black and non-emitting (just like a blank shader) the opposite "backfacing" side of the plane.
By switching the Emission node connection to the first Mix Shader input sockets, it's obviously possible to invert the direction of the light emission.
18.219.13.53