Lighting La Ruelle - Chapter 1 (Maya): Fog/Mist (Damp) at Nighttime
A damp, foggy, misty night. These words can't help but stir the imagination. The atmosphere they create lays a backdrop to many a story: horror, suspense, mystery, or drama. Perhaps monsters lurk around corners, silent killers stalk their targets, or shady deals go on in mysterious alleyways.
Although we will be lighting this environment with a relatively simple lighting solution and not require complete accuracy, it's still important to carefully set up the scene to ensure quick rendering and optimal settings.
Our task is to light and render the scene in this manner, creating the same emotion and depth as those first four words evoke. As with any project that demands a near photoreal depiction of a real life phenomena the key to the initial stages is research.
After collecting hundreds of images that show these conditions, we can start to break them down into key elements for reference. The main images you should look for are:
• Fog, or heavy mist that gets stronger with distance.
• Headlamps or lights that have a halo, or appear blurred and brighter.
• Lights and light rays cast through the mist, creating volumetric effects.
• Tones becoming muted and less colorful.
• Objects in the foreground appearing more silhouetted.
• Low lying mist that silhouettes other objects.
• Light dispersing slowly through the scene, giving a blurred, ghostlike appearance to any objects caught in between.
Now that we know a few of the elements that make up the image, we can start to work out how to achieve these effects in 3D.
We start off with the basic scene, simple textures set up on all objects, and a camera angle.
The scene is not particularly detailed, with all our detail coming from textures, bump maps, and specular maps. This is sufficient because our final image will be just that - an image, and thus we won't require any close ups of certain areas.
Lets jump right in there and place our primary light source. This is the main light contribution for the scene and will be our streetlamp. It's a unique and central feature that will cast some interesting shadows around the scene (Fig.01).
Choose an area light from the Create > Light menu and it will appear at the centre of the scene. Switch to the Transform tool and move the light in place inside the frame of the streetlamp. The direction of the area light will be wrong, so just rotate it to face downward (Fig.02).
Now it's facing downward, we need to turn it into a Mental Ray area light. In the attribute editor of the light, scroll down and find Mental Ray. Click Use Light Shape, then select Sphere from the light. That will let us simulate a round bulb reasonably accurately (Fig.03).
Let's now set up exposure controls on our camera. Exposure controls are a relatively new addition to Mental Ray. They let you control the brightness, gamma, contrast, vignetting, and white balance among other things. Rather than tweak lights and shaders all the time, you can create varying exposures or alterations to the images all from one page of options (See Image Exposure1).
It's as easy to set up as selecting from the viewport menu - View > Camera Attribute Editor... then scroll down and find the Mental Ray dropdown. In there are 3 shaders we can apply to our camera. The one we want to play with now is the Lens shader. Click on the icon to the right and select mia_exposure_photographic1 from the list.
Inside of the photographic exposure controls (See Image Exposure2) there are a wealth of options that might not all be clear immediately but will be explained as we use them during the course of the series. The ones we need to concentrate on now are these:
• Camera Shutter - Essentially controls the brightness of the scene. Lower values mean brighter images.
• Vignetting - Adds a darker border to mainly the corners of the image, mimicking the real camera effect. Adds realism.
• Whitepoint - For now we leave it on white, but this will modify the white balance of the scene, letting us control warmth and coolness without making changes to lights or textures.
Now we have our light and exposure settings set up we should make sure that our main light is actually acting as a Mental Ray physical light and the color is using the kelvin scale, making it easier and more accurate to set the warmth or coolness of the light.
Select the light and make sure you're in the attribute editor (CTRL+A). Under the Shadows dropdown, tick the box Use Mental Ray Shadow Overrides. Under the Shadow Map Overrides section, click Take Settings from Maya, and just adjust the values to the ones in the image.
The important values are Sample, which controls the quality of the shadow, and Softness, which lets us control whether the shadow is sharp or soft. With a bit of trial and error we can adjust it to produce a shadow that looks realistic for our setting.
Under the Custom Shaders dropdown, tick Suppress All Maya Shaders, and click the icon next to Light Shader.
The Create Render Node menu will pop up and there will be a bunch of tabs along the top. On the right hand side there is the Mental Ray tab. Under this scroll down to Mental Ray Light, and select Physical Light from the list (See Image LightShader1).
You will notice the Physical Light attributes show up on the right, and we can leave them as they are. The only thing we want to change is the color. We want to use the kelvin scale, so click the icon next to Color and select Mib_cie_d from the mental ray lights list (See Image LightShader2).
Now modify the Temperature to around 4500. Lower values mean a warmer color that would be closer to red, and higher values indicate cooler colors.
We can type in an intensity value of 50,000 for now, as our main concern is creating a good looking image and not physical realism.
Modern 3D applications have a great feature that lets you see lighting and effects in the viewport without even rendering a thing. It's these realtime effects that let us set up light sources, design shadows, and modify bump values much quicker than ever before (See Image LightShader3).
You can see in the following screenshot that with the bar along the top of the viewport we can turn on viewport lights (See Image ViewportRender).
To really see the viewport more accurately, turn on viewport shadows also (See Image ViewportRender02).
Use these features to fine tune the light intensity and placement (Fig.04 - 05).
If you do render now, you will see the scene is very bright and not exclusively lit by the light we just created. This is because each of our textures has an ambient color value that is set to grey by default when importing an FBX (Fig.06).
It's a good time to mention rendering, and setting up our render settings. There are many many settings that effect the render in Maya, but fortunately, it's not necessary to modify every one of them to produce a good looking test or production render.
First of all, we have to be sure that Maya is using Mental Ray to render the image. Open the render settings dialog (highlighted in red in the image). At the top of the dialog box that appears you can see two dropdown boxes. The second one is Render Using. Open this and select Mental Ray from the list (Fig.07).
On some occasions Mental Ray might not even appear here, but no fear, simply go to the Menu and select Window > Settings/Preferences/Plug-in Manager and from the resulting dialog scroll down and find MayatoMR. Make sure Loaded and Auto-load is set to On (or ticked). You should now be able to select Mental Ray from Render Using list (Fig.08).
In future parts of this tutorial set I will explain the render settings in more depth, but this tutorial is designed to quickly produce a good looking image. The important things to look at in the render settings are the Image Format where we can set the file extension, and the Image Size. Set the image size to 2500x1874 if you want to render exactly as the final image. Here you can also set up the resolution, if rendering for web or print.
Check that the Renderable Cameras is set to Camera01 so our main scene camera is rendered and not the perspective view.
There are a couple more settings to alter still, so switch the tab to Quality and notice the Quality Presets dropdown near the top. These quality presets alter many render settings at once.
We can select Draft from the list to very quickly render our scene, mainly to check things like the balance of lighting, the colors, or the amount of fog we have.
Preview we can use to fine tune shadow shapes, shadows, light bouncing and specularity on objects.
We can switch to Production once we need to render our final image, and also to fine tune close up bump maps which demand a crisp render to see how they really look (Fig.09).
Now let's switch to the Indirect Lighting tab (Fig.10). Without altering any settings simply check on Final Gathering and Ambient Occlusion. These two features will be further explained later, but basically they increase the realism of our scene, lighting it up more evenly and producing soft shadows in corners and cracks (See Fig.06)
It's simple now to just click on each object in turn (using viewport selection or through the outliner), and turn the ambient color value down to a pure black (Fig.11).
Now the result is more accurate and we can see our scene properly lit by our light. Notice that I've given the glass of the street lamp a yellowish bright color and increased the transparency to almost .9. In the Render Stats section I have also unclicked Receive Shadows (Fig.12).
It's a good time to now add our second lightsource. What would normally be the sun is this time the moon. The moon can be rudementaly simulated by a direct light which we will position above the scene. With the direct light we can rotate it to position the shadows exactly where we want them. The fuller the moon the stronger the shadows are, and with a bright full moon there are often shadows visible, but they are usually more diffuse and soft than that of direct sunlight.
Place the direct light in an aesthetically pleasing location and then modify the Color Attribute to be a dark and saturated blue. As we said earlier, most moonlight photos are quite neutral and are not blue, however, our eyes perceive moonlight with a blue tint. To make a pleasing and well balanced image it's up to our artistic direction to combine reality with appearances in order to create our own mood. Also decrease the intensity a little, as this is not our main source of light (Fig.13).
In the following two images you can see how the additional blue light creates a new mood and adds atmosphere to the scene. It also hints further at the lighting conditions (Fig.14 - 15).
The image is coming along nicely and our main lightsources have been placed. Now is as good a time as any to place our fog. It will help us see the final balance of the color and lighting and let us more accurately position and tweak additional light sources.
Fog is a tricky subject and so is mist. Often done in post production, in Maya we can create them quite simply using fluids.
Position the camera ready to start creating our fog and mist (Fig.16).
Under the Fluid Effects menu, click on Create 3d Container. The container will appear and you can use the Size Attributes along with manual positioning to try and "fill" the alleyway area with our container.
It's a good time now to increase the resolution in all axes, so change the resolution to 40,10, and 75 respectively. This should create all equal squares on the grid. If it doesn't, just adjust the resolution yourself to try and create equal squares.
Now we need to adjust the properties of this fluid container to really make it look like low lying mist. Under the Contents Method dropdown, the Texture dropdown, and the Shading Quality dropdown, copy the settings from the below two images (Fig.17 - 18).
Important options to note are the Frequency and Shading Quality. Shading quality will have a big effect on the render time, so you should reduce this to only the minimum needed. Frequency will essentially create larger or smaller clouds. It's recommended to play around with each of these settings and see in the viewport exactly what differences they make. It's possible to make some very realistic and interesting clouds, mist, fog, and smoke using this container, and it's also very easy to animate, so make sure it's one of the tools in your arsenal.
Note on the right side under Render Stats, I have unticked Receive and Cast Shadows. There is really no need for this with mist. You can also uncheck Primary Visibility whilst tuning the rest of the scene, turning it on at the end when we want our mist to show (Fig.19).
Now duplicate this fluid by copy and pasting and then move it to cover the area under the left window and in front of the camera. That should fill up that area nicely and we can move on to creating our depth fog.
Create a new fluid container that fills up the location from the camera to the steps, and also fills the whole area up vertically. Use the same settings as the mist for Display and Contents Method. Turn off Texture Color and Texture Opacity, under the Texture dropdown, as all we need is a fine fog.
As you can see it is very easy to create depth fog in the Maya software renderer, however, that's unfortunately not the case with Mental Ray (Fig.20).
Under the Shading dropdown, we need to increase the Transparency to 0.999. It should be really fine and see-through, but noticeable in the render. The dropoff can be set to Cube and Edge dropoff set to around 0.8 to ensure it's not obvious when it touches the buildings (Fig.21).
Now that the scene is starting to look respectable, we need to add some elements to make it a bit more interesting. We can start off by turning on some of the lights in the windows, namely the one above the door and the one on the right hand side, seeing as those will be primary focus points in the image.
In your image editing program, select the panes of the window on the texture and either use Hue Saturation and Lightness to turn them into a bright yellow, or you can simply paint them yourself. I find painting the edges of the glass darker helps sell the "light on" look (Fig.22).
It's also a good time to put this on a separate layer. Fill a lower layer with black and use the resulting image to produce a glow map, isolating the glow to those specific areas we want (Fig.23).
Back in Maya, use that glow map in the Special Effects channel of the material. Do a test render and see if it's too strong a glow, which it probably is (Fig.24).
If it is then you can modify the Alpha Gain attribute of the texture to a lower figure to find a glow that isn't quite so strong. This is one of the main points that makes Maya simple shaders so powerful; adding glows without post production is a quick and easy process (Fig.25).
Now our image is complete and it wasn't a particularly difficult process. It can be quick and easy to light and render a scene in Maya. We can render our final images using the render settings from the quick guide earlier. Select Production from the list, and make sure Final Gathering and Ambient Occlusion are selected. I've also gone into the Quality section and changed the Anti Aliasing setting from Gauss to Mitchell, as it produces a sharper image.
I hope you found this tutorial useful in quickly lighting a moonlit, foggy scene in Maya. Future chapters will go into more detail regarding topics such as light physics, linear workflow, daylight systems, importons, and irridiance particles.