Tutorials
Materials and Lighting Tips
Materials and Lighting Tips
Ted Boardman tedb@tbmax.com http://www.tbmax.com
Winter has swept into New England from Canada with a vengeance, bringing temperatures as low as –9F on the coast (-40F inland) with brisk winds to make it feel much colder. The salt water in the bay in front of my house is freezing over in spite of bright clear skies and the sea smoke on the open water of the river in the morning is 10 to 20 feet high when the wind is not too strong.
Snow has not been as big an issue as it was last year, with the exception of the one storm in December, but we have gotten enough smaller storms to keep a nice clean coating on everything to help avoid the monochrome “brown” look that is so prevalent in snow-less winters.
Speaking of snow, in this months column I’m going to walk through the creation of a snowy mountain landscape that took less than 20 minutes and illustrates a couple of points in modeling and materials that could come in handy.
Also, a favorite pastime on cold winter days is visiting art museums. I’ve noticed images posted on various forums lately that have pictures hanging on walls with dedicated lights and the result is often not very convincing because of the light pattern on the walls. We’ll have a look at Attenuation for special effects that can improve the control you have over Standard lights.
I’ll also point out some modeling methods I used to give me control over the walls in the lighting scene, both in terms of quick changes to geometry and material assignments.
Both examples have been created in VIZ 4 so the techniques carry fine to max 4-6 and the files can be opened in any of the versions.
Snowy Mountain Scene
The first scene is a snowy mountain landscape (see Figure 1) that was created very quickly and can be adjusted quite easily by using procedural maps for both modeling and materials.
Figure 1: Quick and dirty mountain scene using procedural maps
The scene has two objects and seven lights, a Plane at 2000 feet square as the ground and a Geosphere with the normals flipped as the skydome. Everything else is accomplished with the Material Editor. There is a Direct light as the sun (exclude the Skydome) and six Omni lights (with shadow casting off) evenly spaced around the scene at a height about half way up the skydome. These help light the model and influence the Translucency of the sky. See Figure 2.
Figure 2: A Plane 2000 feet by 2000 feet with a hemisphere and seven lights make up the scene.
The Sky Material
The Sky material is simply a Gradient Ramp, with the colors set to blues and white, rotated 90 degrees and adjusted to fit the Camera01 view by adjusting the Tiling and Offset values of the map. A little of the built-in Noise was added to give the transition between colors a little roughness to simulate a cloudy horizon. See Figure 3.
Figure 3: The sky is a Gradient Ramp map with a few adjustments to the Tiling and Offset, the Rotation, and the Noise levels.
One trick to make the sky bolder and the reason for the six Omni lights around the scene is to use the Translucent shader for the material with the same Gradient Ramp in the Translucent Color slot that is used in the Diffuse slot. See Figure 4. This makes it seem as though the sky is emitting light, not just painted on the inside of the skydome.
Figure 4: Using the Translucent Shader with the map from the Diffuse slot in the Translucent Color slot can boost the intensity of the sky to avoid the “painted on” look.
Tip: Make the clone of the Diffuse Gradient Ramp a Copy when you drag it to the Translucency Color map slot and play with different colors. Also, try reducing the Opacity in the Translucent Basic Parameters rollout and change the Filter Color for different effects.
Displacing The Mountains
Again, the mountains are created from a flat Plane with a Gradient Ramp map in the Displacement slot. In a Displacement map white pixels create new vertices raised from the original surface and black pixels do nothing. Gray pixels fall somewhere between.
The Gradient Ramp map in this case was set to Radial Gradient type with a bit of Noise added and some adjustments made to the Flags to set the colors of the ramp. See Figure 5 for the Displacement map settings and a Top view showing the map on the plane.
Figure 5: A Gradient Ramp set to Radial with a little Noise added and applied to the Displacement slot can be used to generate mountainous landscapes.
To make the Displacement appear in the viewports you can select the Plane and apply a Displace Mesh World Space modifier. In the Modify panel, check the Custom Settings option. I have set this example to use Curvature Subdivision Method and have set the Angle to 13. See Figure 6. This optimizes the mesh so it is not quite so dense. This entire scene only has 3831 faces. I have also set the Displacement amount to 150 in the Maps rollout to adjust the height of the mountains.
Figure 6: In the World Space Displace Mesh modifier Custom Settings is checked, Curvature is chosen, and Angle is set to 13 to optimize the mesh for fewer faces. The Gradient Ramp map is showing on the displaced plane in the viewport.
Try experimenting with the Gradient Ramp map to obtain totally different landscapes; you may have to click the Update Mesh button in the Modify panel to see some of the changes in the viewports.
Putting Snow on the Mountains
The process of creating the illusion of a material piled on an object is one that shows up in tutorials occaisionally, but I’ll repeat it here to show how to create snow on the mountains. It takes advantage of the Falloff map type’s ability to use the Local Z-axis to determine the direction of Perpendicular and Parallel face normal direction.
Note: The landscape plane was created originally in the Top viewport so it’s Local Z-axis points upward. It corresponds to the World Z-axis, which also could be used as the determining factor in Perpendicular/Parallel. The main difference is that Local will allow objects to be rotated and the material will rotate with the object in all axis, while using World would cause the object to rotate through the material in the X- and Y-axis.
The Falloff map used in the Diffuse color slot has the black and white color swatches swapped so that white shows on the Front (faces perpendicular to Local Z-axis) and black shows on the Side (faces parallel to Local Z-axis). The axis direction has been set in the Falloff Direction slot. Any faces not perpendicular or parallel get a shade of gray based on their angle to the Z-axis. This causes the transition from white to black to be too soft to look like snow, so I have adjusted the Mix Curve for the Falloff map by adding a control point and setting a hard edge. Moving the two control points left or right will adjust how much “snow” there is. See Figure 7.
Figure 7: Diffuse Falloff map with colors swapped and Falloff Direction set to Local Z-axis. A point has been added to the Mix Curve and it has been adjusted for a hard edge between black and white. Note the checkboxes to the right of Map#6 and Map#3 have been disabled at this point in the exercise for clarity.
The result shows in the viewport as white on the flatter areas of the landscape and black on the steeper areas as seen in Figure 8. Again, the points in the Mix Curve could be moved left or right for less or more snow and the curve between the two point could be flattened for more transition between black and white.
Figure 8: The results of the Falloff map appears like snow buildup in the flatter areas of the mountains.
Before adjusting more of the colors of the maps, I added a Smoke map to the Bump slot, increased the Smoke size, then adjusted the Bump Amount to 15. This gives the illusion of wind swept snow as well as roughing up the rock surface which, in turn, influences the perceived Local Z-axis direction of the faces making a more convincing snow pack. See Figure 9.
Figure 9: A Smoke bump map set to an Amount of 15 and a size of 500 gives the illusion of rougher snow.
More color was added to the Diffuse slot with a new Falloff map in the Front slot and a Smoke within a Smoke map to add texture to the rock areas.
The Falloff map used in the Front (snow) slot has been set to Falloff Type Shadow/Light and the Shaded color swatch was set to blue. This causes the shaded areas of the bump map on the snow to be bluish while the directly lit areas remain pure white. See Figure 10.
Figure 10: A new Falloff map is used with Shadow/Light Falloff Type and the Shaded swatch changed to blue to create bluish shadows in the snow. The rock colors are set with a Smoke within a Smoke map for variations.
The final image seen in Figure 1 is a good start on the way to a convincing scene and the main points of the exercise are that the initial work can be done very quickly and efficiently and still leaves room for very easy editing of the model, the materials, and the lighting. Slight changes in either one could result in very dramatic differences in the rendered image.
Attenuation Options for Standard Lights
In this next section I will illustrate the use of a seldom-used Attenuation option called Near Attenuation. The scene is a simple corner of a room that was created by lofting a rectangle along an L-shaped path. The rectangle was then modified by adding vertices with Divide at Segment level, then moving the new vertices into position to describe molding, a chair rail, and a baseboard. The Path and Shape Steps of the loft object were set to 0 to reduce unnecessary faces and Smoothing was turned off to clean eliminate odd shading.
A Multi/Sub-Object material was applied with six materials so that each part of the wall receives a new material (the same material is used for baseboard, chair rail, and cove so only 3 different materials are assigned to this wall) depending on the Material ID assigned to the segments of the original 2D shape. See Figure 11.
Figure 11: The lofted wall uses Material ID’s assigned at Segment level to the original loft shape. The material assignments can now be changed very quickly.
If the wall materials had a pattern the sizing could be adjusted with the Length and Width Repeat settings in the Modify panel for the lofted wall or you could use MeshSelect modifiers to select by Material ID # to apply UVW Map modifiers to each material.
Now that we have the construction of the wall down let’s get to the point of the exercise. Figure 12 shows the result of placing a Target Spot near the ceiling to shine on the painting. The beam of light is cone shaped so does not appear to be shining from the long fixture in front of the picture and the light is brighter on the floor than on the picture because of angle of incidence to the surfaces.
Figure 12: A Standard Target Spot does not look like it is coming from the fixture and is much too bright on the floor.
Most of you will know that the light should have Attenuation so that it never reaches the floor but what to do about the coverage and shape of the light cone coming from the fixture. In this example I have changed the shape of the light by checking Rectangle in the Spotlight Parameters rollout of the Modify panel. Then, with the light selected, I typed the $ (shift-4) for a Spot01 viewport. This allows us to see exactly what the light “sees”. Tip: Turning on Show Safe Frame keeps the viewport at the correct aspect ratio. I then use the navigation buttons and Parameters settings and Aspect spinner to resize the Hotspot to fit the painting and the Falloff to fit the frame plus a little. See Figure 13. Show Cone has been checked to see the light blue Hotspot rectangle in the Spot01 viewport.
Figure 13: Use the $ (shift 4) to see the selected light viewport. Set the light to Rectangle and the sizes and aspect to fit the area you want to light.
Now set the Far Attenuation so that the light dies shortly after the bottom of the painting’s frame, you must check the Use option and set the two ranges. The Start range is where the light begins to die and after the End range there is no more light. See Figure 14.
Figure 14: Far Attenuation diminishes the light from the Start range to the End range.
Figure 15 shows that the light now looks pretty good at the bottom of the painting, but the fixture itself is brightly lit by the Spot and the light starts too high up on the frame to be convincing.
Figure 15: The light dies out at the bottom of the painting, but the fixture is brightly lit and too much of the top of the frame is lit.
You can use the Near Attenuation to fix this. The light does not shine from the source to the Start range of the Near Attenuation then increases brightness until the End range of Near Attenuation, so just the opposite of the Far Attenuation.
Check the Use checkbox for Near Attenuation and adjust the Start and End ranges to be at the top edge of the frame and the top edge of the picture respectively. This keeps the light from shining on the fixture and the top of the frame for a more convincing look. See Figure 16. The light can now be much brighter to bring attention to the painting without over-lighting the rest of the scene.
Figure 16: The combination of Near and Far Attenuation can make a light more convincing by controlling where the light starts and ends it’s beam.
What you are essentially doing is adjusting the shape of the light source from a point to a circle or rectangle and controlling how much light strikes objects close to or far away form the source.
Summary
Displacement mapping can be a powerful tool for modeling objects that would be difficult using other methods. Always be aware of the mesh size being created as it can get out of control rather quickly. Use the built-in optimization tools and remember that you can always resort to the Snapshot tool to make an Editable Mesh copy of the displaced mesh. Then you can try applying the Optimize or MultiRes modifier to reduce the overhead.
Falloff maps are one of the most versatile maps in your max and VIZ arsenal. Play with them and try all the options to see what useful variations you might come up with.
Also, use the Near Attenuation of Standard lights to adjust the shape of the light source from a single point to a circle or rectangle and to make the lights much more flexible by controlling where the light starts and ends.
Good luck and have fun
Ted
DOWNLOAD MAX FILE (41KB)
About this article
Materials and Lighting Tips