'3D Studio Max'

.
"Canyon material using advanced procedurals and Vertex Colours" by Peter Åsberg


Hello and welcome to the third installment of my procedural tutorials. This will be a quite advanced tutorial since the final result will include a ton of layered procedurals, a vertex colour mask, some bitmap masks and a gradient ramp with LOTS of flags. This is what my version looks like, hopefully the end result of this tutorial will be somewhat similar (click the image for a larger version)
If you don't have a clue what I'm talking about when I say procedural, I suggest reading the help file that comes with 3dsmax. Or you can look through part one of this series, Procedural Wood and then proceed to tutorial number two, Anisotropic metal shader.
I will asume that you know what you're doing in the material editor in 3dsmax and that you don't need a number specific tutorials. Due to the complexity of this material, I won't be putting up images for every little dialog that pops up. I will however do my best to make it easy to follow my logic (what logic?).
One VERY important thing to remember when dealing with procedural maps is that size matters. The scale of your scene and the scale of my scene will most likely not be the same. Thus, a size of 10 for a noise map might look right in my scene, but be way too small or too big in your scene. I will put some scene specifics at the beginning of the tutorial. Another thing to remember is that the scale of the sphere in the material editor will of course affect the look of the material in the material preview. Which is another thing I will touch on.
Lastly, this material can be summed up in one sentence: you use vertex colours to specify where you want the mud, then you use two bitmaps and some cellular trickery to mask in the water between the cracks. That's the extremely short version of it. Now on to the long version.
Maps used
First of all, lets review what we'll be using for this shader.
Noise map.
We will be putting this one to good use. I recommend downloading the Blur Noise map (avaliable from the Blur Beta page) because you can have level settings higher than 10. This is very good when you have a large size but you still want the fine detail. Regular noise works well too of course since pretty much everything but the number of avaliable levels is the same. One thing to take note of: the regular noise can be displayed in the viewport, blur noise can't.
Cellular map.
This one is another very versatile map which will be used for the cracked mud.
Mix map.
This map is impossible to do without. The ability to mix maps is essential to a good material.
Composite map.
It does what it says. Composites different maps together, pretty much the same way layers work in Photoshop, but without the lovely opacity controls and blending modes. On a side note, there is a plugin in development that features just that, Photoshop style blending of maps. It can be picked up from Michael Spaw, the Max Plugin section.
Falloff map.
The falloff map is another map that is incredibly useful. You can use it to fade between two colours or maps depending on light/shadow, perpendicularity to the camera etc etc. Read all about it in the documentation.
Output map.
Another neat little map. This one will let you adjust the colour values, output ammount, offset and a bunch of other stuff. One of the most interesting uses, in this tutorial, is the Bump Ammount spinner. We will use it to tweak the different layers of the bump maps used. It has two siblings by the name of RGB Multiply and RGB Tint. They are geared towards colour correcting only though. Lastly, I must mention Color Correct by Cuneyt Ozdas which is like the output map on steroids. Visit that site for more must-have plugins.
Raytrace map.
This is just to add reflections to the water. It's pretty darn slow when you mask it as we will be doing though, so you might want to find another solution (environment mapping for example) or render in passes.
Electric map.
The Electric map blended with the Noise map gives a very nice bump map as I will be showing later. It's also handy for caustic effects in pools and on sea floors for example. Avaliable from the Blur Beta page.
Solid Color map.
This is just what the name says. A solid colour map. If, for example you need a completely white material, this can give you that. And you have controlable alpha value too. Very simple, and pretty usefull now and then. Avaliable from the Blur Beta page.
What do we want?

When I started making the canyon material, I had in mind something with sediment layers, a rocky surface and a stream at the bottom. On either side of the stream there would be a band of cracked mud, with water snaking trough the cracks. Since I didn't plan on modeling the cracked mud, the snaking water would have to be part of the material and not a separate plane with a water material applied. A separate plane would've produced a very cg look because of the smooth intersection of water and canyon wall. I set off to find reference, and for some reason I can't find as nice refrences this time around. I found some really nice shots from Myst 3 - Exile and some other general images. I did a quick search for this tutorial and came up with this photo, an image from Myst 3 - Exile and another image from Exile. They aren't the best, but as I had a pretty clear idea when I started, I didn't really need much reference. Besides, I had an irc channel I could bug with updates. Co-workers, friends and irc are great ways to get feedback fast. Very much recommended.
Onwards!
General info

First of all, in my canyon scene, you can fit a sphere with a 65 unit radius between the canyon walls. The material editor 3d Map Sample Scale is set to 25 (it's in the options dialog). This will affect how large the procedural maps will appear in the material preview, and it will be one reason that your maps might not look the same as the screenshots. I also cheated somewhat with the uv-mapping of the walls and the vertex painting. I applied a uvw modifier, collapsed the stack and then edited the geometry to get the sediments to be even more wavy than they actually are. You don't have to do this, but it helps. For the vertex painting, the higher resolution mesh, the smoother the vertex colouring. I started to paint the general outline of the stream, then I applied a meshsmooth (1 iteration) and painted on top of that to get more detail. You could keep doing this, but the end result will be a fairly heavy mesh, and it's not always worth it.
The colour map

Lets start with the colour map (aka diffuse map). It will need one layer with sediment, a gradient ramp with a bunch of colours jammed together. Then there is the mud layer, and some general splotches of colour to top it all off. The water will be the last, and trickiest, layer. Here's a screenshot of the completed diffuse tree including the water. Please note the naming of materials. VERY IMPORTANT. When I did this material I didn't name a single map, and it's taken me quite a while to sort it all out :) Below is a render of the diffuse map with a vertex colour mask. Looks boring without the bump map...


3DTotal Advertisement - We need your support!

As well as you tutorial hungry people eating through a terabit of bandwidth each month we also have many additional staff and running costs involved in creating these free pages. We want to continue bringing you many free tutorials and resources everyday, so PLEASE check out our products and amazon affiliate schemes via the above banners. Many thanks!



How the f...?

Start by putting a Composite material, with two map slots, in the diffuse slot. The first one will be the canyon wall and mud diffuse, the second will be used for water. I will say this one last time, name the maps so you can easily navigate the material tree later on. Right, the Composite map will be called "Diffuse - Main Composite".
Put a Mix map in slot one, this will be used to mix the mud and canyon wall diffuse maps with a Vertex Colour map. Put a Cellular map in the first mix slot and adjust the values accordingly, then put Noise maps in the colour slot and the first division slot. This is to give the mud more variation.
On to the canyon wall. The canyon wall map is a mix between a Gradient Ramp and an Electric map. Put a Mix map in the slot below the mud to begin with. Name it "canyon wall diffuse mix" (or "blah" :) In the first slot you put the Gradient Ramp, name it "sediment lines".
Here comes one of the tedious parts: creating the sediment lines by adding a bunch of flags and giving them slightly different colour. Just click in the gradient some 10-20 times, then right click a flag, chose properties. Then you can just use the arrows in that window to jump from flag to flag, adjust the position, and the colour without having to select each flag individually. This is also where canyon reference comes in handy, so you can get a general idea of how the sediment lines look. Displaying the map in the viewport is a good way to get feedback on how thick the bands are and how much the noise is affecting it. The reason I have a 1.7 tile on the gradient ramp is that I uv mapped the canyon very sloppily, and that it's easier to edit the gradient ramp when it's tiled. You don't have to have as many flags to get thin stripes.
In the second slot we dump an Electric map, the "general splotch" map. This is just to get some general colour splotches on top of the sediment layer. The mix value I used is around 35. Not too strong, or the colour of the sediments will be all but lost.
Back up one level to the "canyon wall diffuse mix". This is a neat little trick: put a Vertex Colour Map in the mix amount slot. This will let you use the nice little vertex colour map you painted (or will paint) as a mask. That's how I did the smiley face on the sphere, just slap a Vertex Paint modifier on the sphere, start drawing and you're set. Very handy in other cases too, for example painting dirt, shadows etc. Be creative! Here's a screenshot of the canyon and mud mix map.
I'm going to discuss the water map last of all, because it will use a lot of map instancing from the bump map for use as masks and some bitmap trickery. Which means, we move on to the bump map.
 
3D Total Homepage