home about gallery publications education links contact


..::canyon::..

With the numerous plugins out there, and additional external programs, we can generate effective terrain easily. But these can cost money, and also take quite a while to render due to the high geometry count needed to create displaced rock effects. In this tutorial we’re going to create a procedurally generated landscape incorporating a canyon directly from within 3ds max’s own toolkit and also handle any geometry refinement with maps, so any additional geometry will only be in the places where we want it. This means we can increase the polygon count and not worry too much about the render times. The texturing is going to be handled partly within 3ds max (for mixing maps and materials and to handle the displacement and geometry refinement) and partly with Photoshop (texture painting and detail) to add some realism and weathering to the texture map. We’ll also light the scene using a lighting rig to simulate GI and finally, we’ll add some scale to the scene by adding environmental effects and a pre-rendered panoramic sky to finish off the image.

Enlarge Screenshot
In the Top Viewport, create a Plane primitive and label it “Terrain”. Set the Length and Width settings to 20000, the Length and Width Segs to 5. Add a UVW Mapping modifier to the stack.
Enlarge Screenshot
Add a Volume Select modifier, right-click it and rename it to “Refinement Selection 1”. Set the Stack Selection Level to Face and Surface Features to Texture Map. Add a Meshsmooth modifier and set the number of Iterations to 4. Turn off this modifier for the time being by clicking on the lightbulb icon next to it.
Enlarge Screenshot
Add a Volume Select modifier and rename it to “Refinement Selection 2”. Set the Stack Selection Level to Face and Surface Features to Texture Map. Add a Meshsmooth modifier, set the number of Iterations to 1, enable the Render Values Iterations and set it to 3. Turn off this modifier for the time being by clicking on the lightbulb icon next to it.
Enlarge Screenshot
Add a Mesh Select Modifier to clear the selection. Add a Displace Modifier and rename it to “Displacement Stagger”. Set the Strength to 2500, and turn on Luminance Center. Set the Length setting to 80040 (4 times the original) and set V Tile to 4.
Enlarge Screenshot
Add another Displace Modifier and rename it to “Displacement Step”. Set the Strength to 2500, and turn on Luminance Center. Set the Length setting to 80040 and set V Tile to 4. These displace modifiers do not tile outside of the gizmo so we have had to increase their length, and thus the tiling equally.
Enlarge Screenshot
In the Material Editor, click on Get Material, create a new Gradient Ramp map and label it Displacement Stagger. Set the Blur offset to 0.01 and Interpolation to Solid. Remove the middle flag and create flags at positions 40, 43 and 45 with RGB colours 100,100,100 37, 37, 37 and 0,0,0 respectfully. Set the flag at position 0 to 128,128,128.
Enlarge Screenshot
Create flags at positions 57, 58 and 60 and set the colours to RGB 37,37,37 100,100,100 and 128,128,128 respectfully. Set the Noise Amount spinner to 0.4, check on Turbulence, Size to 10 and Levels to 10. Select the Displacement Stagger Modifier and drag the Gradient Ramp map to the Image Map slot in the Modifier. Select Instance Clone when prompted.
Enlarge Screenshot
Drag the map to another material slot and rename it Displacement Step. Remove all flags and set the Noise Size to 11. Create flags at positions 28 & 72 (RGB 145,145,145), 33 & 67 (RGB 123,123,123), 38 & 63 (RGB 100,100,100), 39 & 59 (RGB 37,37,37), 41 & 57 (RGB 18,18,18), 44 (RGB 0,0,0), 61 (RGB 57,57,57) and 80 (RGB 128, 128, 128). Select the Displacement Step Modifier and drag this Gradient Ramp map to the Image Map slot in the Modifier. Select Instance Clone when prompted.
Enlarge Screenshot
Copy the Displacement Stagger map to a new slot and label it “Refinement Selection 1”. Set the V Offset to 0.5, Blur Offset to 0.001 and remove all flags in the gradient. Create flags at positions 12 and 90 and set them to white and black as illustrated. Set flag 0 to black. Instance copy this map to the Map slot of the Refinement Selection 1 Modifier. Turn the first Meshsmooth back on and in the Meshsmooth Modifier turn off Apply to Whole Mesh.
Enlarge Screenshot
Copy the Refinement Selection 1 map to a new slot and label it “Refinement Selection 2”. Move the flag at position 12 to position 10 and the flag at position 90 to position 86. Create flags at positions 46 and 56 and set their colours to black and white respectfully.
Enlarge Screenshot
Click on the Gradient Ramp button and create a new Mask Map. Keep old map when prompted. Drop a Gradient map into the Mask’s Mask slot and set all colours to white and turn off U and V Tiling. Go back up to the Mask map and instance copy this Mask map to the Map slot of the Refinement Selection 2 Modifier. Turn this Meshsmooth back on and turn off Apply to Whole Mesh as before.
Enlarge Screenshot
Add a new Volume Select Modifier to the top of the stack and rename it to “Canyon Base Relax”. Set the Stack Selection Level to Vertex, turn on Soft Selection and set the Falloff to 500. Reposition the Volume Select’s Gizmo in the Front Viewport so the bottom most vertices are selected as illustrated.
Enlarge Screenshot
Add a Relax Modifier to the stack and set the Relax Value to 1 and Iterations to 10. Turn off Keep Boundary Points Fixed. Add a Volume Select Modifier to the stack and rename it to “Canyon Internal Inverted”. Set the Stack Selection Level to Vertex, check on Invert, and in the Surface Features section, enable Texture Map.
Enlarge Screenshot
Copy the Refinement Selection 1 map to a new slot and rename it “Canyon Internal Selection”. Turn off U Tiling and change the Interpolation to Ease In Out. Remove all flags and create Black flags at positions 25 and 80 and create white flags at positions 27 and 70. Set flags at positions 0 and 100 to black and Instance clone this map to the map slot of the Canyon Internal Inverted modifier.
Enlarge Screenshot
Add a Displace Modifier and label it “Canyon External Displacement”. Set the Strength to 500. Create a new Smoke map and label it “Canyon External Displacement”. Change the Source mapping to Explicit Map Channel, Size to 0.3, Iterations to 20 and Exponent to 0.75. Instance clone this map to the Map slot of the new Canyon External Displacement Modifier.
Enlarge Screenshot
Add a Mesh Select Modifier to the stack to clear the Sub-Object selection. Add a UVW Map Modifier and set the Map Channel to 2. Change the alignment to Y and click on Fit. Set the Width spinner setting to 120020 to stretch out the Modifier’s Gizmo.
Enlarge Screenshot
In the Material Editor, create a new Top/Bottom material and label it “Terrain”. Set it’s Coordinates to Local, Blend to 10 and Position to 90. In the Top slot, add a Blend material and label it “Top”. In the Blend’s Material 1 slot, add another Blend material and label it Canyon. Label the Canyon Material 1 as “Canyon Main” and set the diffuse colour to any green. Label the Canyon Blend Material 2 as Water. Set its Specular Level to 180 and Glossiness to 80.
Enlarge Screenshot
Move back up the material tree and label the Top Blend Material 2 material as “Canyon External”. In the Diffuse slot, add a Mix map and label it “External Texture Mixer”. Add a Diffuse Map to Mix slot 1 and load in the “sand_tilable_green.bmp” texture. Set U and V tiling to 2.
Enlarge Screenshot
Copy this map into Mix slot 2 and set the U & V tiling to 5. In the Output rollout, amend the RGB Offset to 0.2 and RGB Level to 1.3. In the Mix map’s mix slot, add a Smoke map and label it “External Mix Control”. Set the Source mapping to Explicit Map Channel, Size to 0.3, Iterations to 20 and Exponent to 0.75.
Enlarge Screenshot
In the Canyon External material’s Bump slot, add a Mix map and label it External Bump Mixer. Instance Copy the External Texture Mixer to Colour slot 1 of this new Mix map and set the Mix Amount to 30. Add a Cellular map to the Colour slot 2 and label it “External Large Cracks”.
Enlarge Screenshot
Set the Source mapping to Explicit Map Channel and set Division colour 2 to RGB 60,60,60. Set the Cell type to Chips, turn on Fractal, size to 0.2 and Iterations to 1.5. In the Cell Colour slot, add another Cellular map, label it “External Small Cracks”, set source mapping to Explicit Map Channel, division colour 1 to RGB 183,183,183, Division colour 2 to RGB 60,60,60, Size to 0.03, Chip cell type, and Fractal enabled. Clone this Cellular map into the External Large Cracks Division colour 1 slot.
Enlarge Screenshot
In the Top Blend material, add an Output map to the Mask slot and Label “Internal Selection Inverter”. Expand the Output rollout and enable Invert. Instance copy the Canyon Internal Selection gradient ramp to this Output map’s map slot, thus inverting the map while maintaining the original. Right at the top of the material tree, rename the Bottom material of the Top/Bottom material to “Canyon Internal Side”.
Enlarge Screenshot
In this material’s Diffuse slot, add a Bitmap map and load in the “Sandstone 01.tif” file. Set the Map Channel to 2 and Blur offset to 0.01. In this material’s Bump slot, add a Mix map, label it Side Bump Mix, set the Mix Amount to 50.
Enlarge Screenshot
Instance copy the Sandstone bitmap into Slot 2, and add another Mix map to Slot 1. Label this “Step Mixer”, set the Mix Amount to 50 and Instance copy the “Displacement Step” Gradient to Slot 1 and the “Displacement Stagger” Gradient to Slot 2. Assign this entire Material tree setup to the Terrain plane. Centre the entire mesh in the Top Viewport and render off a large size square image so we can use this as our template for painting our textures. If it takes too long to calculate the mesh, reduce the 2nd Meshsmooth’s Render Iteration setting.
Enlarge Screenshot
Load the render into Photoshop and crop it to the plane’s boundaries. Add the “sand.jpg” image to the canvas and by using the green areas of the render as a guide, dodge and burn using large and small stippled brushes to create weathering effects around the edge of ledges and differences in sand texture. Duplicate this layer and set to Multiply blending. Create another layer and set to Linear Burn and using the same method, paint different green areas onto the ledges and inside the canyon to simulate foliage.
Enlarge Screenshot
Using the Pen tool, draw out line(s) down then centre of the canyon to create a river. Stroke this and shade it a dark brown. On a new layer create an Overlay layer and add highlights to the river. Stroke the brown line with a thin white line on a new Soft Light layer and blur it slightly to create a weathered effect to the river. Add an additional Soft Light layer and edge up the canyon’s edges. Finally add a Hue/Saturation adjustment layer and reduce the saturation by 30.
Enlarge Screenshot
Offset filter all layers and by using the Snapshot and/or Healing Brush ensure the entire image tiles vertically by removing any seams and ensuring the river’s top and bottom edges line up. Reverse the offset and save a copy of the image. On a copy of the image, fill the river layer white (whilst maintaining transparency) and drop in a solid black background behind it. Save this out as the reflection mask.
Enlarge Screenshot
Create a Geosphere that encompasses the Plane with a radius of 40000, Hemisphere checked on, situated just beneath the plane, and label it “Sky”. Add a Normal Modifier and a UVW Map modifier and set to Cylindrical. Create a new material, label it Sky and set Self Illumination to 100. Load in the “sky_panorama.bmp” image into the Diffuse slot and assign the material to the Sky dome. Scale the object down by 30% along the Z axis.
Enlarge Screenshot
In the Canyon Main material, load the saved Diffuse map you created into the Diffuse Slot and instance copy it into the Bump slot with the Bump spinner set to 10. In the Canyon Blend Mix material, drop the Reflection Mask map you created into the Mask slot. In the Water material, drop the saved Diffuse map into the Diffuse slot, the Reflection Mask map into the Bump slot (set to -100) and a Raytrace map into the Reflection slot (set to 30).
Enlarge Screenshot
Create a new Gradient Ramp Map and label it “Fogging Texture”. Set to Spherical Environment mapping, and set the W Angle spinner to 90. Change Interpolation to Custom, remove the middle flag and create flags at 26 (RGB 162,168,151) 40 (RGB 80,130,170), 49 (RGB 221,231,241) 55 (RGB 80,130,170) with flag 0 set to RGB 213,192,140 and flag 100 set to RGB 80,130,170. Copy this map and label it Fogging Opacity. Remove all flags and create new ones at 49 and 55, and set flags 0 and 49 to RGB 101,101,101 and 55 and 100 to black.
Enlarge Screenshot
Create a camera point down the and across the canyon. Show Environment Ranges and set the far range to 60000. Add a Fog Atmospheric effect in the Environment settings and label it “Fog – Layered”. Instance copy the Fogging Texture to the Fog’s Colour Map slot and the Fogging Opacity map to the Opacity Map slot. Check on Layered and set Top to -200, Bottom to -2500, Density to 50 and Falloff to Top. Add another Fog map, rename to “Fog – Distance” and assign the maps as before. Check on Exponential.
Enlarge Screenshot Back at the base of the Canyon plane’s stack, increase both render multipliers to 4. Set up the lighting (covered in the margin notes due to the amount of space left in this tutorial) and render out the scene. In the Raytracer Global settings you may wish to reduce the depth to speed up rendering times as only the sky and terrain are being reflected. You may wish to go back into Photoshop and refine your texture, adding detail such as rock decals, additional shading on the water and so on, but the end result as it stands is very effective.
Download the max file! Zip file to accompany

..::additional tips::..

The lighting in this scene can be set up as follows (check screenshot 31 for light positioning reference and screenshot 32 for settings reference). Create a Target Direct light and position so the target is in the centre of the canyon. Turn on Shadows, set the Multiplier to 0.035 and set the Colour to RGB 191,206,221 . Check on Overshoot, set the Falloff/Field to 12000 and turn off Specular. Set the Bias to 0.001, Size to 256 and Sample Range to 10. Instance copy this light to the opposite side of the first light’s target (equidistant to the opposing light). (…continued in the next margin note)

Select both lights and rotate and instance clone again and again until you have a ring of lights. Select this ring of lights (not the targets) instance clone them again and reposition them above the last ring. Move them inwards slightly by using Local transformation. Perform this another couple of times so you have a hemisphere of lights and one ring of lights underneath the canyon pointing upwards. Copy (not instance) one light, reposition overhead and name it sun. Change the shadow type to Ray Traced, Multiplier to 1, colour to RGB 255, 255, 231, set the Falloff/Field to 15000 and turn Specular back on.

In addition to having just flat ridges, additional displacement and detail can be added by adding procedural noise or smoke maps to the flags in the displacement Gradient Ramp maps. The two colours contained in these procedural maps would need to be very similar to the original colour of the flag it represents so it only creates a slight displacement in the mesh. Too much and the ridge will be overly distorted.

Add additional elements such as flocking birds to the scene to give the scene a greater sense of scale. These can be generated using a Particle Cloud particle system (or by using Discreet’s new Particle Flow system if you are on the subscription programme), by using particles that reference a low polygon animated bird. One good example of this procedure (originally designed for Lightwave, but can be easily converted to 3ds max) can be found in 3D World issue 31.

You may feel that render times go through the roof when rendering out this scene! To bring these down you could turn off bump mapping for all or some of the materials, reduce the amount of Raytracer depth, completely replace the Raytrace map with an image map reflection, reduce the polygon count by reducing the number of iterations in the Meshsmooth Modifiers, amend the Refinement gradients so less polygons are selected (thus less are refined) or remove one (or both) of the volumetrics in the scene.

There are, as always, very good plugin solutions to create terrain. Dreamscape is pretty much the leader of the pack when it comes to plugins of this nature, due to its terrain editing and voxel rendering (no more waiting for that lengthy render!). Its cloud generation toolkit is equally as impressive; the cloud panorama included with this tutorial was constructed using Dreamscape and output as a panorama using a feature from within the plugin.

Initially published: Computer Arts magazine, Issue 87, September 2003.

Copyright © Pete Draper, September 2003. Reproduction without permission prohibited.

www.xenomorphic.co.uk