From: Gabriel Reich
I would like to add bump maps, textures (like metal, stone, and skin), and just add a bit more realism.
The Hypershade is your friend. It allows you to create shader networks very quickly, using an intuitive, node-based, hypergraph format. For best results, the Hypershade should be used in conjunction with the Attribute Editor (found on the right hand side of the main Maya window).
Here's a quick tutorial to make a shader with a 3D bump map and a 2D color texture:
1. Project DirectorySet up a proper project directory if you haven't done so already. This should always be the very first thing you do whenever you begin a new project in Maya. Otherwise, you'll end up overwriting your previous renderings with your new ones each time (among other problems). Obviously, you don't want to do that.
In the main Maya window, click File -> Project -> New. In the dialog that pops up, give your project a name. Then click Use Defaults to set up the proper directory structure. When you're done, click OK.
2. Take a look at the Hypershade (Window -> Rendering Editors -> Hypershade)Take a good look at it. The layout is pretty simple. In the left hand pane, make sure the Create tab is showing. Don't worry about the Bins tab right now; you won't be needing it for this. Under the Create tab, you'll find creation nodes for all your various surface materials, 2D & 3D textures, utilities, etc.
On the right hand side, you'll find two panes. The upper one is simply called the Top Tabs (notice it's got a whole bunch of tabs at its top), and the lower one is called the Work Area. Put simply, the Top Tabs are where all your materials (and other rendering items) are kept organized, and the Work Area is where you edit them.
In the Top Tabs, the only tab we're going to use in this tutorial is the Materials tab. Don't worry about any of the others right now.
Navigating the Work Area is just like navigating any of the main viewer panes. Alt-left-drag zooms in and out. Alt-middle-drag pans. Alt-left-drag does not apply, since you can't rotate a 2D window.
Note, you don't have unlimited alt-zoom in the Top Tabs (don't ask me why). You just have 4 levels of maginfication, and you can only scroll vertically. Inconsistent as that is with just about everything else in Maya, it isn't that big a deal. It's not often (at least for SL work) that you'll have so many materials in your scene that you'll need to to much, if any, zooming in the Top Tabs (assuming you have a good size monitor, that is). You'll zoom all over the Work Area constantly, though.
3. Create a new material in the HypershadeIn the Create tab, click one of the buttons under the Surfaces heading to create a new material. Let's do a Lambert, since that's the simplest to understand (fewest attributes). Lambert shaders reflect light similarly to how matte (non-shiny) materials do in RL. (The other commonly used materials, so you know are are Blinn, which has a metallic look, Phong, which is glossy, and Anisotropic, which diffuses its reflections similarly to how brushed metal does.)
When you click the button, you'll notice that a new Lambert node appears in both the Top Tabs and in the Work Area. They're both the same material; you didn't actually create two. Remember, the Top Tabs shows all the materials in the scene. The Work Area shows whatever materials you happen to be working on at the moment. You can drag a material from the Top Tabs to the Work Area (with the middle mouse button) at any time to work on it. Since the one we're working on now is brand new, it's already in the Work Area by default. Maya assumes when you create something new it's because you intend to work on it right away.
4. Assign your material to your objectIn any Maya viewer pane, click to select your object. Then in the Hypershade, right click on your new Lambert node, drag the mouse to the Assign intialShadingGroup To Selection button, and release. You can do this from either the Top Tabs or the Work Area. Your object now has your new material on it instead of the default material.
In the next step, we're going to take a quick look at the Attribute Editor. Before we go any further, let's get something clear right away. You don't actually need to be using the Hypershade at all. You could do everything directly in the Attribute Editor. However, the Hypershade makes it easier to understand what's happening, since you can see it all visually. If you prefer to work only with menus, then the Attribute Editor is just fine. I think you'll find that being able to see the graphical representation of your shader network is very helpful, though. With that in mind, let's take a look at the Attribute Editor.
5. Examine the material's attributes in the Attribute EditorIn the Work Area, double click on your new Lambert node (or just click it once, and then press ctrl-A). Take a look at the right hand side of your main Maya window. You'll see that the Attribute Editor has opened. There you can see all the attributes of your selected material. The names are pretty self explanatory (color, transparency, incandescence, etc.).
As I said above, you could just use the sliders, fields, and the options buttons next to each attribute to finish creating your shader from here. If you want to do that, there's nothing wrong with it. But again, the Hypershade helps you understand better what's actually happening, and it's a lot faster. So we'll using both in this tutorial. We'll construct the framework of the shader in the Hypershade, and edit each component's properties in the Attribute Editor.
What we are going to do with the Attibute Editor at this time is rename the material, so it's easy to keep track of. Toward the top, you'll see the word "Lambert:" with a white field to its right. In that field is the material's name. Right now, it's probably called Lambert2 or something, since if you've done nothing else, this is the second Lambert in the scene (Lambert1 is the defualt material). You can rename your Lambert to whatever you want. For this tutorial, let's go with "gabrielsFirstShader". Type that in the white field, and press Enter. You'll see the name shown the Hypershade instantly updates to reflect the change.
6. ColorYou said you wanted to use an existing 2D texture for the material's color. Before we do anything else, grab that file, and copy it to the sourceImages folder of your current Maya project. The reason to do this is so your project will be self-contained. This way, if you ever want to move it to another machine, or give it to someone, or work collaboratively with another artist, etc., everything will be in one place. Otherwise, you'd need to hunt down every last file every time, and you'd then have to redirect all your materials' file references to the new locations. That can be a real pain. Use the directory structure properly, and you'll never have those problems.
Also, before we go any further, I should mention that technically, anything you could paint by hand in Photoshop (or any other paint program), you could also create procedurally in Maya. But learning to make complex imagery procedurally is a big subject. We're going to touch on it briefly in a few minutes when we make your 3D bump map, so you will get a taste of it, but since using a 2D texture for color is what you were asking about, that's what we're going to do here.
In the Create tab in the Hypershade, in the 3D Textures section, click the button for File. You'll see a new file node appear the Work area, along with a placement node. Depending on where you were already zoomed, the new nodes may have appeared directly on top of the old one. That's OK. To move them around, just left-drag them anywhere you want. Their positions on screen don't affect how they work. What's important is just to keep things organized so you can keep track of them.
For now, the simplest thing to do is to move the three nodes so that they're in a neat row, with the placement node on the left, the file node in the middle, and the material node (garbielsFirstShader) on the right.
As their names would suggest, the file node is what you'll use to pick your 2D image file, and the placement node is what you'll use to position it on your object's surface. (If it helps, think of the file node kind of like the texture picker in SL, and the 2D placement node as the repeats & offsets settings.) To pick a file, we'll be editing the file node's attributes in the Attribute Editor. So double click on the file node in the Hypershade. This will open it in the Attribute Editor, just like how we opened the material node a minute ago.
See where it says Image Name? Click on the little folder button to the right of that, and then navigate to wherever you've got your image stored. Notice the first place it looks by default is in sourceImages. Hopefully you put the file there like I told you. Technically you don't have to, but things can get messy if you don't.
Now, the only thing remaining is to tell Maya you want the file to be the color for your material. In the Hypershade Work Area, middle-drag the file node onto the material node and let go. In the popup menu that appears, click on Color. The file node is now mapped to the material's color channel. You should see the texture on the model now.
Be aware that depending on the complexity of the model's shape, and of the texture itself, the Maya viewer may not show you the texture in detail. It might look blurry right now. That's OK. To see it clearly, just do a quick test render. Remember, the viewer is optimized for performance. It's not intended to be a fully accurate display of every last thing in your scene. That's why we render.
If you want to adjust the positioning of the texture on the model double click the placement node in the Hypershade to open it in the Attribute Editor. The attributes are pretty self explanatory. You can change the repeats, rotation, offsets, etc., just like in SL (plus a few other things).
7. BumpIf you want to, you can assign an existing image file to the material's bump channel, the same way we just did it for the color channel. You could create a grayscale bump map in Photoshop (or any other paint program), and then repeat the process we just did, except this time, choose Bump instead of Color when you middle-drag the file node onto the material node.
But since you already know how to do that, let's take this opportunity to advance your knowledge one step further. Let's use a 3D texture this time instead of a 2D one. The advantage of 3D textures is that they get placed evenly across the entire model. The shape of the model does not cause them to squish, stretch, shear, etc., in any way. The disadvantage is they can break if you move the model (so they're not well suited for animation, for example). But for something as simple sculpties, that shouldn't be an issue.
In the Hypershade, scroll down the Create tab to the 3D Textures section. You can use any kind of texture you want for this. Let's go with Volume Noise. If you're familiar with the noise filter in Photoshop, this is basically the same thing, but in 3D. It works very well for creating all kinds of uniformly bumpy textures, from granite to stucco to leather to skin.
Click on the Volume Noise button. You'll see two new nodes appear, the volume noise node itself, plus a 3D texture placement node. As before, feel free to move the nodes around the Work Area any way you want, so that you can easily keep track of everything. Middle drag the volume noise node onto the material node, and in the popup menu, choose Bump. The noise is now mapped to the material's bump channel.
By default, the Maya viewer will not show you bump mapping. To see it, you can either do a test render, or you can switch the viewer to high quality rendering instead of default. For the latter, you'll need a powerful video card, and lots of RAM. If you're lacking in either, I'd suggest you don't try it. But if you have sufficient hardware, then in the white menu bar at the top of the perspective pane, click Renderer -> High Quality Rendering. Just be sure to save your file first. If your hardware isn't up to snuff for this, Maya may well crash on you.
Anyway, to adjust the properties of the volume noise, take a look at it in the Attribute Editor (you should know how by now; double click it in the Hypershade). The attributes are fairly self explanatory. Feel free to experiment with them to see what they all do.
To adjust the placement of the noise pattern on the surface, you guessed it, edit the 3D placement node in the Attribute Editor. Notice, though, that 2D attributes, like UV repeats and such, are not present. That's because this is a 3D placement node, not a 2D placement node. This node has no idea what UV's even are. All it knows is that a 3-dimensional pattern exists in space, and where that pattern happens to occupy the same space as your material surface, the former affects the latter in some way (which in this case happens to be by acting as a bump map).
At this point, you're probably going to end up doing lots and lots of test renders to get the bumps exactly how you want them. That's OK. That's exactly what you're supposed to do. These things take time. Don't be afraid to spend a lot of extra hours tweaking the attributes, and rendering to see the results.
Lighting & BakingI would not recommend using ambient lights as your main light source, if at all. They are completely unrealistic. I also wouldn't recommend just using spot lights, as Pygora had suggested. That's totally unrealistic too.
What I would suggest is that you learn about global illumination, final gather, and ambient occlusion. That's where the foundation of realism is going to come from 90% of the time, especially with baked textures. Use spotlights, pointlights, etc. for accent, not for primary lighting.
This is counter to what most tutorials on lighting will tell you. That's because most tutorials are not written with baking in mind. When you're rendering a flat image from just one point of view, your lighting setup is often similar to RL stage lighting, and the effects can be stunning. But when you're baking, that kind of thing just doesn't work. You want your model to be lit from all sides at once, since it's going to be seen from every angle. That's where global illumination comes in. Final gather and/or ambient occlusion are tools which help surfaces shade properly when globally illuminated.
Lighting is way too big a subject for a basic tutorial like this one. To learn about it, you're going to need to read, read, read, and practice, practice, practice.
As for baking out the texture, I take it you already know how to do that since you didn't ask how. The instructions will vary greatly, depending on what renderer you're using. If you're in the market for a good renderer, I suggest Turtle. It's the only renderer in the world specifically designed for baking. Other renderers can do it, but Turtle puts everything in one convenient place, it's fast, and it produces very high quality results with relative ease. It takes a lot of work to get something like Mental Ray to yield results that look even close to as good as Turtle's results look by default.
If all you've got is Maya Software and Mental Ray, don't be discouraged, though. You can still get good results. It just takes a lot longer, and it's more complicated to set up. You can find some basic instructions for both at
http://fromthehill.nl/tutorials/bake/index.html . I don't like the lighting scheme the author uses, but all the steps to output a texture are present.
I hope this has been helpful.