CHAPTER 6

image

Material Creation and
Texture Painting

 

 

Gray plastic is getting really old. So far we’ve created some great looking forms and taken some extensive time to do the hard work of good UV layouts. Now we get to reap the benefits of that hard work and start texturing our surfaces to bring some real life to the scenes.

Nomenclature

There is some nomenclature here that we should cover before we go too far. People will often talk of “texturing” their objects or scene. What the artist usually means is that he plans to add color or other visual surface properties to his collection of polygons. But this usually is done through three different things: textures, materials, and shaders.

Textures are images. A texture can be used to define the color of an object, or other things like where the object is shiny (via a specular map), or how bumpy a surface will appear (via a bump, normal, or displacement map). Maya is pretty tolerant as to what format it will accept textures in. Tiffs, jpgs, pngs, or even Photoshop files will work in most cases (although certain rendering engines don’t like some formats — Mental Ray dislikes Photoshop for instance). This means that textures can be painted in a lot of different places. For our purposes, we will be painting our textures in Photoshop, although our final output will be a tiff.

Textures by themselves are pretty useless though. In order for them to be assembled (one texture for color, one for bump, etc.), Maya uses the idea of creating Materials. These materials are what are actually applied to the mesh. A material can be reused on multiple objects or a single object can have multiple materials assigned to different polygon selections.

Materials can be of several types. These different types are called Shaders. A shader is really the cumulative result of textures within materials and will include the final visual product like whether the surface appears shiny, reflective, transparent, etc. Shaders can exist outside and independent of materials in some cases — but generally (and for our purposes in this volume), we will be using Materials of various Shader types to define surfaces.

To better understand how all this fits together, let’s look at Maya’s methodology for creating and managing materials — the Hypershade.

The Hypershade

The Hypershade (accessible via Window > Rendering Editors > Hypershade) has several general areas that are important to understand (Fig. 6.1).

image

FIG 6.1 The Hypershade.

Typical of Maya, this window is dense with tools and options. The general areas that are important to us are these:

Create Area: This is the area on the far left of the window. The Create tab signals the area. Beneath this tab is a list of different types of shaders that are available for different types of rendering engines. When any of the shaders beneath the rendering engines (Maya or Mental ray) are selected, the column next to it will present some buttons that are specific shader types. When a particular shader type is clicked, a material of that type will be created and show up in the Materials area.

Hypershade Top Tabs: I know — dumb name, but it’s what Maya officially calls them. What this is talking about is the area that is represented in Fig. 6.1 by the Materials tab. I like to think of this area as a sort of shelf. Beneath each tab, the user can see what materials have been created (and stored) in relationship to the scene created. Notice there are also other tabs for things like Textures. Again, the idea here is that when the Texture tab is clicked, you can see what Textures have been linked to materials in the scene.

Work Area: This area — directly beneath the shelves that hold the materials or textures allows for materials to be constructed or modified. By middle-mouse-dragging a material or texture from the space above down to the work area — that node (material or texture) will be represented and can be graphed to show how the material is put together or how the texture is tied to certain materials.

For an example of how all these work together, try this:

Step 1: Open the last saved version of the Escaping the Madness game level.

Step 2: Open the Hypershade.

Step 3: Middle-mouse-drag the checkerboard material (probably called lambert2) from the Materials area down into the work area.

Step 4: Within the Hypershade, choose Graph > Input and Output Connections (Fig. 6.2).

image

FIG 6.2 Graphing a material.

What’s happening here is the material (lambert2) and the textures that define it (checker1) are laid out with arrows indicating how these various nodes are connected. If the mouse is moved over the arrows that connect the nodes and left there for a second — a little yellow hint box will pop up (as it has in Fig. 6.2 with the mouse hidden for clarity) that shows which attribute is coming out of one node (checker1.outColor in 6.2) and into what attribute of the next (lambert2.color). So in Fig. 6.2, the color of the checker1 node is defining the color attribute of the material lambert2.

Creating and Applying Materials

In the last chapter, out of necessity, we took a quick look at creating a new material. There are a few ways to create and apply textures: In the Hypershade, a new material is creating by clicking one of the shader type buttons (Anisotropic, Blinn, Hair Tube Shader, Lambert, Layered Shader, etc.). When this is done, a new material will be created and show up in the Materials tab.

This material can then be applied to an object by middle-mouse-dragging it from the Hypershade to the object in the View Panel, or by selecting an object (or objects) in the View Panel and then in the Hypershade right-clicking on the material and choosing Assign Material to Selection, or by right-clicking on an object in the View Panel and choosing Assign Existing Material > Name of Material from the Hotbox.

Alternately, in the View Panels, right-clicking on an object and choosing Assign New Material will bring up a window that looks just like the left part of the Hypershade (the Create area) that allows you to create a new material. Once you pick a type of material to make, Maya creates the new material and automatically assigns it to the object.

There are lots of ways of connecting nodes within the Hypershade. But some of the easiest ways to adjust materials is through the Attribute Editor. If any node is double-clicked in the Hypershade, the attributes of that node will appear in the Attribute Editor, where they can be easily edited. Remember that in the last chapter, we assigned the checkerboard texture to our newly created material via the Attribute Editor.

But enough talk. The best way to see how all this fits together is by creating some materials. Even more fun will be making materials that are tied to textures to make the scene feel much more “real.”

Tutorial 6.1 Game Level and Architectural Texturing

We will start off by creating the textures for the room we UV mapped in the last chapter. There are fewer surfaces there and it will be easier to see the direct correlation between how the textures are built and their usage and placement in the space.

Remember that before working on creating textures, you must have a well laid out UV map and a UV Snapshot of that layout. Remember from the last chapter that this UV Snapshot will (by default) be saved within the images folder of the Project folder.

Walls

Step 1: Set your Project. Remember to do this, choose File > Set Project … and then navigate to the Escaping the Madness folder.

Why?

Why are we bringing this up again? There is a very critical thing to remember about textures: Maya doesn’t actually import any of the texture files into the .mb scene — rather it links to these files. This means that keeping your textures and keeping track of where those textures are is important. It’s why having a properly set Project is critical in Maya. If the texture files move or if Maya doesn’t understand where they are stored — all the materials you created using those textures will break and likely render as solid black.

Step 2: Ensure that you have a UV Snapshot of the wall object. To check this, if you followed the last chapters tutorials, this UV Snapshot should be within the images folder of your Project file and be named ETM_RoomWest1UVS. If it is not there, repeat the steps of outputting a UV Snapshot: In Maya, select the walls shape, then in the UV Texture Editor select Polygons > UV Snapshot. The resolution we used in the last chapter was 2048 × 2048.

Tips and Tricks

You can certainly use your own UV layout for this step or you can grab the .mb file Hallway_Chapter5UV_End.mb off the support website (http://www.GettingStartedIn3D.com).

Texture Resources

We’re going to call what we’re about to do “painting textures,” but in reality we are going to be doing photo assemblage with Photoshop. There may be some of you out there reading this book that are incredible enough illustrators to really paint (digitally or traditionally) the textures for things like walls — and in fact, depending on the style of a game or scene, a painted look can be a very interesting choice. But, for our purposes, we will be using photographs of surfaces to create our custom textures.

Ideally, you go out and take your own photographs to use as source material. However, in a pinch and for mockups and educational exercises like this, there are some online resources that are very effective. My personal favorite is CG Textures (http://www.cgtextures.com). This site requires an account — which just takes a minute to set up; but most of the assets are free and it can be an incredibly quick and effective source for photos.

As per the license agreement on the site: “One or more textures on this map have been created with images from CGTextures.com. These images may not be redistributed by default. Please visit www.cgtextures.com for more information.”

In the course of this tutorial, I will be using several textures from CG Textures. I’ll be calling out which textures I used — and you can go grab the exact textures as well; or feel free to grab similar textures to make the surface your own.

Photoshop Preparation

Before we can start effectively painting textures, we need to a bit of adjustment to our UV Snapshot.

Step 3: Prepare the UV Snapshot. Do this by opening the UV Snapshot in Photoshop (ETM_roomWest1UVs if you followed the past tutorials). In the Layers palette, Cntrl-click Layer 0. Choose Edit > Stroke. In the Stroke dialog box, change the width to 5 px and change the color to a solid black. Hit OK.

Why?

Some of the steps here might seem to be invisible. When the file is first opened, you’ll see just the hint of the UVs in this snapshot. This is because the UV lines are laid out with a very, very thin line and with such a big image (2048 × 2048) it’s just tough to see them. Cntrl-clicking selects the content of Layer 0 and then we are stroking that selection by five pixels with black which makes the UV Snapshot much easier to see. When it’s easier to see, it’s easier to know where textures are being placed.

Step 4: Rename Layer 0 to UV Snapshot. Do this in the Layers palette by double-clicking the words Layer 0.

Step 5: Save the file as ETM_RoomWest1Raw.psd. Save this in the images folder of your project file.

Why?

I usually like to keep two copies of my textures: a raw multi-layered version that I can go back and adjust easily and a flattened version that I actually use as a texture in my Maya materials. Just to keep things clean, I like to keep my raw versions with the UV snapshots from which they came (in the images folder), and then later, when I save out the flattened version, I’ll save that to the source images folder — where Maya will expect to find texture files for materials.

Step 6: Find and download a plaster base image from CG Textures. The plaster base image I used is linked to at www.GettingStartedIn3D.com in the Tutorials & Support Files under the Chapter 6 topic. Note that in this case, I am using one of the “tiled” textures. Open this file in Photoshop and copy its content to the ETM_RoomWest1Raw file.

Tips and Tricks

Notice that in CG Textures, some textures are listed as “Tiled.” This means that the texture will repeat without yielding unsightly seams. Generally, these are best to use for repeating base textures. You’re not limited to those that are tiled, however — be sure to check out Appendix B for details on how to make your own seamless textures.

Step 7: Use the Free Transform tool (Edit > Free Transform) to resize the texture, so that it is an appropriate size on the wall (Fig. 6.3). Again, holding Shift will maintain the proportions of the selection as it is resized.

image

FIG 6.3 Pasted texture laid beneath the UV Snapshot layer.

Why?

The size of this texture is just a guess. In all reality, it’s pretty tough to know how that texture will look to scale until it’s actually applied to the Maya scene. Generally, tiled textures are meant to be tiled and usually are not going to fill the entire surface with one copy.

Step 8: Duplicate the texture enough times to fill the wall (Fig. 6.4).

image

FIG 6.4 Duplicated tile to fill the wall.

Tips and Tricks

Remember that using the Move Tool while holding the Alt (or Option on a Mac) key will duplicate the layer as it is moved. Remember to snap the tiles together.

 

Why?

So there are some strange things that you may notice now. First, the texture is going off the right end of the wall in my screenshot. This is OK as there is no other UVs to the right and so that overlap won’t cause any problems. The second issue to notice is that even though the texture is seamless (there are no hard lines), you can definitely begin to pick out a pattern. This really is an issue and is undesirable (unless dealing with things like ceramic tiles). But don’t sweat it now. When we start layering textures, most of this repeating stuff will be toned down.

Step 9: Merge all the copies to one layer. In the Layers Palette, select all the many duplicates of this plaster base image and choose Layer > Merge Layers.

Step 10: Duplicate this merged layer to cover the other wall.

Step 11: Duplicate plaster base for the ceiling. In my UV snapshot, this is the shape in the bottom left. If you’re unclear which is which in yours, just open your scene in Maya, select the faces you’re after, and then in the UV Texture Editor look at which are highlighted. At this point, there should be plaster base for all the walls and the ceiling (Fig. 6.5).

image

FIG 6.5 Plaster base laid out for all surfaces but the floor.

Step 12: Rename the layers to Ceiling Base, Wall 1 Base, and Wall 2 Base. If you’re unfamiliar with Photoshop, you can do this by double-clicking the name of a layer and then typing the new name.

Why?

We’re about to get complicated in this texture — we’re going to have a whole lot of layers. Keeping track of which layer is critical both to your own workflow and efficacy thereof, but also to peace among your team mates if someone else inherits parts of a project. It’s very frustrating and incredibly time consuming to try and sort through another artists unlabeled work.

Step 13: Find, download, and place a floor base. I’m using a worn wood floor (again, the specific link is listed at the support website). After placing, be sure to label the layer as Floor Base (Fig. 6.6).

image

FIG 6.6 Floor base in place.

Trying It On for Size

So we have a good guess on the size of the texture base images. But, before we go too far with starting to make this texture not appear like a tiled boring space, let’s get it into the Maya scene and see how it’s looking. There may need to be adjustments.

Saving Out a Flattened Texture

We want to keep this multi-layered raw version of the texture (it’s pretty rough at this point), but it’ll save time if we have a flattened, smaller image (like a jpg) to use in Maya.

Step 14: Save the file.

Step 15: Hide the UV Snapshot layer (click off the eye icon in the Layers Palette).

Why?

Being able to see the UVs in Photoshop is important for us, but we don’t want those lines to be baked into the texture that we bring back into Maya. Hiding this layer makes sure we just have the color information and not the map we used to determine it.

Step 16: Use File > Save for Web & Devices to output a jpg. In the Save for Web & Devices dialog, change the Preset to JPEG High and click the Save button. When prompted, choose to save the file (rename it to ETM_RoomWest1Color.jpg) in the sourceimages folder of your project.

Why?

Sourceimages. This folder is important. This is a folder that Maya will always reference files from (remember that the Character Style Sheets were placed here).

Why the new name? Well, this is the first of several textures we will be using over the course of these tutorials. Naming is important, and labeling this texture as a color texture helps keep things straight.

Creating the Wall Material

Time to get back into Maya. Here, we’ll create a new material just for the wall shape and use our rough painting as the color texture map and see how the size of the textures hold up.

Step 17: Create a new wall material. Do this by opening the Hypershade. In the Create Area, click the Lambert button. This will create a new material (probably called lambert3) that will show up in both the Materials tab and the Work area. Double-click this new material, and it should show up in the Attribute Editor as well. Rename the material to Wall_Mat (Fig. 6.7).

image

FIG 6.7 Creating and preparing to edit a new material: Wall_Mat.

Why?

Naming materials matter. It doesn’t take long to name the material (I always like to include _Mat on my materials as it always lets me know that that node is a material) and can be big dividends when assigning materials by name (as in right-clicking on an object and choosing Assign Existing Material from the Hotbox).

 

Tips and Tricks

There are several ways to make new materials. Remember that this could also have been done by right-clicking on the wall object itself and choosing Assign New Material from the Hotbox. Then you could carry on with the following steps in the same way, but the material would have already been applied. For now though, I’m after a familiarity with the Hypershade, so we’re building the new material there.

Step 18: Tell Maya that we plan to use an image to define the color of this material. To do this, in the Attribute Editor, on the Color line, click the little checkerboard button to tell Maya to create a Render Node. Now, in the Create Render Node window click the File button.

Why?

This should feel vaguely familiar. Remember that when we were creating the dummy material (with all the checkers), we followed this same technique, but instead of choosing File, we used the procedural checkerboard. In this case, by choosing File, we are telling Maya that the color attribute of Wall_Mat will be defined by a bitmapped image. Now, we just need to define which image to use.

Step 19: Use our painted texture as the color image. After the last step, the Attribute Editor should have swapped to show the attributes of the newly created file node that it created. There, look for the Image Name input field and click the folder icon on the far right. Maya will open a dialog box that should go to the sourceimages folder of the project file. Choose the painted image we saved there (ETM_RoomWest1Color.jpg). The results should look like Fig. 6.8.

image

FIG 6.8 Results of filling the file node with our image — which in turn will define the color attribute of the Wall_Mat.

Warnings and Pitfalls

If, when you click the folder icon to define the image to use Maya does not take you directly to the sourceimages of your project file — STOP — it means your project isn’t set quite right. It is critical — especially if you ever plan to open this scene on another machine that Maya understands a relative path (not an absolute path) to the texture. Go back and reset your project (File > Set Project) and reopen your file … then repeat the last few steps.

Step 20: Apply this material to the wall shape. To do this, middle-mouse-drag the Wall_Mat from the Hypershade onto the walls of the room (Fig. 6.9).

image

FIG 6.9 Applied material (note this screenshot is viewing the scene with Backface Culling turned on for clarity).

Tips and Tricks

Backface Culling is having Maya only show the front sides of faces. For games, this is really an important idea as most game engines only show the front side of any face. In construction, it can also be of great help as it can let you see into a room from the outside. To turn on Backface Culling, go to the View Panel and choose Shading > Backface Culling. If the room still looks solid from the outside, but transparent from the inside, select the walls and choose Polygon|Normals > Reverse to swap the direction the polygons are facing.

 

Why?

There it is. Some things are working well; the wall base seems to be a reasonable texture size, but the floor feels a bit big to me. Your results may vary depending on the textures you chose. Make note of what needs to be changed, so you can make the necessary adjustments back in Photoshop.

Step 21: Save the scene in Maya and go back to Photoshop.

Layering Textures

Step 22: Make any size adjustments you noted after placing the texture in Maya. If there needs to be extra copies of a texture to help fill space out, make them.

Step 23: Find and download a good “leaking” texture. Figure. 6.10 shows the result of the leaking texture I used from CG Texture (and linked to on the supporting website). The key to this nicely prepared decal is that it already has an alpha channel, so it lays right over the plaster. Note that this dripping decal has been duplicated many tips and is laid everywhere leaks would actually occur.

image

FIG 6.10 Drips.

Why?

This is really a fun texture to do this with. One of the things I really like about CG Textures is that many of the textures are prepared like this, so they can just be dropped right into place. However, there are lots of other ways for layers to work besides just laying one on top of another …

Step 24: Find and download an interesting rust texture. The one I used is linked to on the website. Again, the exact texture isn’t important; but within CG Textures do a quick search on “rust” and plenty of interesting options will come up.

Tips and Tricks

The idea here will be to overlay a big rust texture over the top of the each entire wall. So grabbing a few variations of any of the rust pages will give you a few more options for variation.

Step 25: Copy, paste, and scale (via Free Transform), a couple of the rust textures, so that they cover your entire plaster surfaces (walls and ceiling). Make sure these layers are on top of all the layers but the UV Snapshot layer. Be sure to label them (I used Ceiling Rust Overlay, Wall 2 Rust Overlay, Wall 1 Rust Overlay). The strange results will look something like Fig. 6.11.

image

FIG 6.11 The rust layers.

Why?

“Whoa!” I can hear you saying, “it was making sense until now, but what’s going on there?” I know, it looks strange here; just laying another image over the top seems to negate all the work we did earlier. But hang tight, being able to blend these layers together will yield interesting results in just a few steps.

Step 26: Change the Blending Mode from Normal to Soft Light for each layer. Do this in the Layers palette of Photoshop. The Blend Mode is the drop down menu in the top left of the palette. The results will appear like Fig. 6.12.

image

FIG 6.12 Soft Light blending.

Why?

Blending Mode allows you to tell Photoshop how to blend the selected layer with the layers beneath it. There are different modes to use at different times. Sometimes Multiply is the best solution; but when there is a fairly dark overlay (like this rust image), then Soft Light does just the trick.

Step 27: If desired, adjust the saturation or levels of the rust overlays. My rust textures are turning the whole room a little orange for my taste. But by selecting each of those rust overlay layers and adjusting the Hue/Saturation (Image > Adjustments > Hue/Saturation) and specifically turning the Saturation value down, I can still get the surface disturbance without the overwhelming orange color (Fig. 6.13).

image

FIG 6.13 Adjusted saturation levels of overlay layers.

Step 28: Repeat this process to taste using varieties of textures to dirty corners and break up surfaces until you are happy with the result. My final output looks like Fig. 6.14.

image

FIG 6.14 Finished dirtied, layered texture.

Updating the Texture

Step 29: In Photoshop, save the file (File > Save). Remember this will save the raw Photoshop version in the images folder.

Step 30: Hide the UV Snapshot layer and save out the jpg version to the sourceimages folder (again using File > Save for Web and Devices). Be sure to overwrite the old version.

Step 31: Back in Maya, open the Hypershade and graph the Wall_Mat. Do this by selecting Wall_Mat in the Materials tab and selecting Graph > Input and Output Connections (Fig. 6.15).

image

FIG 6.15 Graphing the input and output connections of the Wall_Mat.

Step 32: Double-click on the file1 node. This will open the attributes of this node in the Attribute Editor.

Why?

This file1 is the node that contains the color texture — the texture we have been working. This is the quickest way to access this node — which we need to in order to update the texture.

Step 33: In the Attribute Editor, have Maya go ahead and recheck the texture file by clicking the Reload button (Fig. 6.16).

image

FIG 6.16 Updated texture within Maya.

Step 34: Adjust, add, or remove elements to taste. Bouncing back and forth between Maya and Photoshop will allow the space to become increasingly refined until you get just the look you’re after.

Expanding the Concepts

Those are the core ideas for the color maps of most architectural efforts. Go ahead and use these ideas to create the color maps for the rest of the room.

Step 35: Create materials and custom textures for the rest of the elements in this room (Fig. 6.17). Leave off the glass of the windows for now — we’ll get to that in a bit.

image

FIG 6.17 Finished color textures for the entire room.

Ambient Occlusion for Texturing

Ambient Occlusion (AO) — for our purposes — is the concept of ambient lighting being occluded (or left out) of certain areas. AO has only recently begun to really assert itself into the 3D artist’s consciousness as the computing power to calculate it has just in the last few years become possible. The way I like to think of AO is visual dirt that collects in corners.

AO can be calculated at render time, but will quickly add significantly to the time it takes to render a scene — which (for animation sake) can add many hours to rendering time. In a game situation, while AO is available, it is often splotchy and also takes a toll on real-time rendering times as well.

Luckily, AO can be “baked” into a texture. Basically, the core concept is to have the rendering engine calculate what the AO would be and output that to an image. Then, we’ll use that image and lay it down as a layer on our textures and get a real-time result that will give a scene dirt and dimension without additional rendering horsepower being spent.

Here’s the process: we’ll create a new type of surface shader that will include directions for Maya to render AO. Then using Maya’s Mental Ray engine, we’ll render objects using the AO and have Maya write that AO darkness to an image. Then, we’ll use that image in Photoshop to apply it permanently to our texture.

Because we’re using Mental Ray, if you have not activated this rendering engine with your Maya install you will need to do so. It’s pretty quick and easy, just go to Windows > Settings/Preferences > Plugins Manager … There, look for the plugin called Mayatomr.mll (that’s Maya to Mental Ray) and click both Loaded and Auto Load check boxes. Then click Close.

Step 36: In Maya, save the scene. We’re about to mess a lot of things up, and it will be important that you have this one saved.

Step 37: Use File > Save As … to save a copy of the scene as ETM_AO_Pass (or something like that).

Why?

This is a safety precaution. We’re about to change a bunch of materials and want to make sure that the version in which we have all of our basic materials created is not lost. By saving and then saving a new version of the file, we help protect against accidental overwrites.

Step 38: Create a new surface shader. Do this in the Hypershade by selecting Create > Materials > Surface Shader.

Step 39: Create an AO texture node. Again, in the Hypershade, choose Create > Mental Ray Textures > mib_amb_occlusion.

Tips and Tricks

Notice that we are creating materials and textures by using the drop down menus. It turns out this can also be done via the Create area lists and buttons. Using the drop down menu in the Hypershade just makes it easier to follow along within a tutorial.

Step 40: Connect these two new nodes in the Work Area. To do this, Cntrl-middle-mouse drag from the bottom right arrow of the AO (mib_amb_occlusion1) node to the bottom left arrow of the surfaceShader1 node (Fig. 6.18). This connects the output of the AO node to the input of the surface shader node. A green arrow will appear showing the connection.

image

FIG 6.18 Connecting the AO to the surface shader.

Why?

This sort of connecting nodes is what the Hypershade is really good at. In fact, any nodes (like color textures and materials) can be connected here in this sort of way. The biggest issue to keep in mind is Maya has lots of freaky ways to connect these nodes (like Cntrl-middle-mouse drag); and it sometimes takes a bit of getting used to (and even experimenting) to get the nodes connected like you want.

Step 41: Adjust the AO node. Double-click the mib_amb_occlusion1 node in the Hypershade, and then in the Attribute Editor change the Samples setting to 256. Additionally, change the Max Distance setting to 50 and the Falloff to 1.

Why?

The number of samples will determine how smooth the final AO pass appears. Sometimes a rougher AO pass (with fewer samples) is a stylistic choice, and sometimes you want to leave this low for early rendering passes. For now though, since this is a simple scene without too many polygons, we can turn up the number of samples from the start.

The other numbers are the results of some trial and error. They have to do with how far out the AO looks for other surfaces when it’s checking for corners and how far out to draw the dark spots. Part of the weirdness of tutorials is somehow these numbers seem to appear instantly — but the reality is I tweaked them up and down until I found the numbers I liked.

 

Tips and Tricks

If you’re using your own scene, you may need to tweak these values as they are based upon the size of the room.

Step 42: Change the render settings to render with Mental Ray. Go to Window > Rendering Editors > Render Settings. Change the Render Using setting to Mental Ray. Click the Quality Tab and change the Quality Presets to Production. Click Close.

Why?

Our AO node only works with Mental Ray as the rendering engine.

Step 43: Apply the new surface shader to the wall shape by middle-mouse-dragging it from the Hypershade to the object. Repeat this for any of the other objects in the room (including the window panes — which probably don’t have a material yet). This will turn everything black. You may want to swap to wireframe node (hit 4 on the keyboard) to be able to make out where you are in the space.

Step 44: Render. To do this, choose Rendering|Render > Render Current Frame. The Render View window will open, and Maya and your computer will chug away to draw an image that finally will look similar to Fig. 6.19.

image

FIG 6.19 Rendering results of the surface shader using AO.

Why?

Pretty strange, eh? Suddenly, the space looks like a ghostly clean hospital room. What’s interesting there though is that any place where two surfaces come together into a corner, there is darkness painted in. Now, we just need to capture that in our textures.

Baking the AO

Baking can mean a few things in 3D animation. Animation can be baked, lighting can be baked, and AO can be baked. The core idea to take something that is computationally heavy and reduce it down to a smaller data set that becomes an easy to compute attribute in Maya. So for animation, baking would take the computationally heavy inverse kinematics calculations and convert this to simple rotation keyframes for joints. For AO, this means calculating the AO and painting the AO onto the texture.

Baking is fairly easy, but does take a while to compute. When rendering a scene, Maya only has to draw what the camera sees. But in baking, Maya is computing every polygon of a surface. This can make testing and tweaking settings pretty rough and slow, but usually the increase in rendering time — or the visual impact in our case — makes the time spent here worthwhile.

Step 42: Bake the AO with a test pass. To bake objects, select them (in this case select all the objects in the scene by marqueeing around them), and then choose Rendering|Lighting/Shading > Batch Bake (mental ray) (Options). Here, adjust the following settings — Bake To: Texture, Bake Optimization: Multiple Objects, and click the Use Bake Set Override checkbox. This will make a lot of other options active in the lower sections. Change the following: Color Mode: Occlusion, Occlusion Rays: 16, Occlusion Falloff: 10. X Resolution: 1024, Y Resolution: 1024. Click Convert and Close and go take a break.

Why?

Most of the settings here are self-explanatory. We are baking an Occlusion pass with a very low number of rays (16) to get a rough idea of whether our falloff (10) is a good one. We are baking to a tiff that is 1024 × 1024. Some of your textures may be bigger or smaller than that (my walls are 2048 × 2048). But since this is just a darkening corner layer, a 1024 × 1024 map can be used and scaled up without much degradation in final output.

Step 43: Tweak if needed and rebake. Take a look at the output, and if the dark spots are to your liking, undo (Cntrl-z) and rebake with higher quality settings. Do this by turning up the Occusion Rays setting to 256 and again hitting Convert and Close. If the darkened regions are too far or two narrow, adjust the Occlusion Falloff settings, and then rebake with the low Occlusion Rays (16) setting. The final results will look something like Fig. 6.20.

image

FIG 6.20 Baked AO pass.

Step 44: Track down the baked textures (Fig. 6.21). They will be within your project file in the path: Escaping the Madness/renderData/mentalray/ lightMap. Open these files in Photoshop.

image

FIG 6.21 AO-baked textures.

Why?

Since we have well laid out UVs (that don’t overlap), Maya has a clear place to paint the AO to. These baked textures have horrific names, but don’t worry, we’re soon to simply copy and paste them into our extant textures.

Step 45: Apply the AO pass to the color textures in Photoshop. To do this, start with the baked texture and Select > Select All. Copy it (Edit > Copy), then open the raw version of your textures (the base color), and paste it (Edit > Paste). Make sure this new layer is labeled AO Pass and make sure it is the top layer — but still beneath the UV Snapshot layer. Change the Blending Mode to Multiply (Fig. 6.22).

image

FIG 6.22 Applying the AO pass to a texture. The image on the left is the base color texture and the image on the right has the AO layer applied.

Why?

Makes a quick difference, eh? Multiply Blending will use the AO Layer’s dark parts to darken the layers beneath it, but essentially ignore the white parts. The net result will be a darkening of all the corners of the textured form.

Step 46: Save out the AO+color version (Save For Web & Devices) and replace the old version of the texture. Back in Maya, Open the original (non-AO) version of the scene. Reload this new texture (Fig. 6.23).

image

FIG 6.23 Before and after of a texture with the AO-baked layer applied.

Step 47: Repeat for all other objects in the room (Fig. 6.24).

image

FIG 6.24 All other objects with AO pass applied.

Why?

A lot of the dirt in corners were created and applied during the texturing process. However, this AO pass always pushes things a bit further. It grounds objects so they look like they are really sitting on the ground and helps to give other objects increased visual volume and form definition.

Beyond Color

So far we’ve built some pretty sophisticated color maps to define the surfaces of the shapes in our room. But materials in Maya can be more than just color — so very much more.

As you’ve probably guessed from the multitude of options available in the Attribute Editor whenever dealing with a material, there are lots of other attributes that can be defined. Covering all of them is outside of the scope of this book, but in the coming steps, we will look at two of them that are particularly useful: Transparency and Bump Mapping.

Transparency

Transparency maps can do some very sophisticated things. When any material is selected and opened in the Attribute Editor, the entire material can be made transparent by simply sliding the Transparency slider to the right. However, this has limited efficacy in our situations as the windows in that dirty of a room should have collected some grime on the window panes as well. They’re old which should mean that the panes of glass are neither clean nor totally transparent. With a transparency texture map, we can define what parts of the window panes are transparent, which are completely opaque and what is somewhere in between.

Now, there are several ways to approach transparency maps. Maya works pretty well with Photoshop documents and can read alpha channels and other built in attributes of a .psd file so that one file can define lots of attributes of a material. However, for illustration sake on how materials are put together, in this tutorial, we are going to create a separate color and transparency maps and tie them in as discreet chains of nodes.

But first, we need to create a quick color texture for the window panes. For this, we’ll use a slightly different method than we have in the past. Namely, we’ll be using the AO pass, as the foundation for our texture. The reason for this has to do with the topology of the window glass pane.

When I modeled the panes, they were built with single polygon planes and put within the window shape. The benefit is that it was a quick solution to have an object for the glass; the drawback is that it would be very tough to try and pick out where each of the transoms and mullions (the wood between the panes) go, and where to place the dirt or other collected grime.

Luckily, the AO pass of these panes (shown in Fig. 6.25) shows us exactly where the individual panes would be. This provides us a great template upon which to build our color map.

A basic idea to remember about these separate transparency maps is that Maya will interpret black pixels as transparent and white pixels as opaque. Gray pixels will render as semi-transparent. With this paradigm in mind, we can create a custom map that defines exactly what’s opaque and what is transparent.

image

FIG 6.25 AO pass that provides important information on where individual panes of glass would be.

Step 48: Open the baked AO texture and then grab some grime materials off of CG Textures and lay in the grime that would be on the individual window panes. Do this in Photoshop (of course) and be sure to keep these grime layers un-flattened (Fig. 6.26). Save this to the images folder as ETM_WindowPanesRaw.psd.

image

FIG 6.26 Rough color map.

Step 49: Use File > Save for Web & Devices to save out a ETM_WindowPanesColor.jpg image to the sourceimages folder. Step 50: In Maya, create a new ETM_WindowsPane_Mat material and use your newly outputted file to define the color (Fig. 6.27).

image

FIG 6.27 Results of flat color map.

Why?

Well, it’s creepy alright, but it’s too creepy — and there’s no transparency. We really need to have some of that window be at least a little bit transparent. Thus, the need to create a custom transparency map.

Step 51: Use Adjustment Layers to create in inversed black and white version of the color map. Do this within Photoshop by going to Layer > New Adjustment Layer > Black & White. Move this layer to the top of your layers in the Layers Palette. Then, go to Layer > New Adjustment Layer > Invert. Again, make sure this is the top of the layers. The results will be a creepy but effective Fig. 6.28. Save the file (the raw version) and then use File > Save for Web & Devices and save out a new ETM_WindowsPaneTransparency.jpg to the sourceimages folder.

image

FIG 6.28 Results of two adjustment layers.

Why?

Adjustment Layers are non-destructive methods to getting broad adjustments to your Photoshop file. For us, this is a perfect use of them as it keeps our color versions within the raw version of the texture. That way, if we decide to change anything, we still have the color information and can simply turn off the Adjustment Layers when it’s time to save out the .jpg color texture for Maya and then reactivate them for a new transparency texture.

Step 52: Implement this new transparency map. Do this in Maya. Open the Hypershade and double-click the ETM_WindowsPane_Mat icon in the Materials tab to open the material in the Attribute Editor. Click the checker button at the end of the Transparency line and choose File from the Create Render Node window. Then, populate that new file node (again in the Attribute Editor) with our newly exported ETM_WindowsPaneTransparency.jpg file.

Why?

It seems like we should be set. In fact if you take a look at the material in the Hypershade it should look something like Fig. 6.29 and indicates that there is indeed transparency on the material. But yet, in the View Panel, everything looks the same … what’s up? Well, Maya is trying to make sure that the scene draws as quickly as possible in the View Panels so as to no slow the creation process down. Because of this, it often ignores certain attributes of materials. We need to tell Maya to draw more than that.

 

image

FIG 6.29 The material network using a color map and a separate transparency map.

Step 53: Tell Maya to draw the transparency channel. There are a couple of ways to do this. The quickest (but most intensive on your video card) is to choose in the persp View Panel Renderer > Viewport 2.0 (Fig. 6.30).

image

FIG 6.30 Using Viewport 2.0 to see transparency. Note the new sphere is just to show that the panes are indeed transparent.

Tips and Tricks

An alternate way to do this is per material and done in the Attribute Editor. Look for the Hardware Texturing section and change the Textured Channel setting to Combined Textures. The results will be more blurry, but will be easier on the video card. If you have a small or old video card, this is probably the best choice for you.

Bump Mapping

Bump mapping is an incredibly useful tool to make geometry look like it has more detail than it really has. Traditionally, bump textures were gray scale images in which Maya interpreted white pixels as raised, and black pixels as recessed. More recently, normal maps have come into vogue which do much the same thing but allow for visual distortion in more than just the straight direction off the face’s normal.

Normal maps can be a bit more opaque to work with, but the results are undeniably better. The problem is that you really can’t paint a normal map directly, but there are some excellent tools to create very nice normal maps from a color map that produces some very nice results.

My favorite is a tool called Crazy Bump (www.CrazyBump.com). It’s a fairly inexpensive tool ($49 for students, $99 for personal use, and $299 for professional, and includes a free trial) that is really the most painless way to generate and control normal maps that I have seen. If you don’t have it, take a moment to download and install it (it’s cross platform).

We aren’t going to spend a lot of time here learning how to use Crazy Bump (this is a Maya book after all), but don’t be intimidated. It’s a quick tool to use and the sliders make for quick and easy adjustments to dial in the look you’re after … the next few steps are a very quick overview (Fig. 6.31).

image

FIG 6.31 Crazy Bump introduction interface.

Step 54: Open a color map in Crazy Bump to convert to a normal map. Using Crazy Bump, click the Open button (labeled as “Click this button to begin”). In the next window, click the Open Photograph from File button and navigate to any of the color textures in your sourceimages folder (I’ll be using the color map from the gurney).

Step 55: In the next window, take your best guess as to which looks better. Often it doesn’t matter which you choose (as this can be adjusted later), but basically the idea is to determine in this dialog whether to raise lighter pixels or lower them.

Step 56: Dial the detail recognition in to get the look you’re after. Figure 6.32 shows my best guesses on the first pass. Remember, we can come back and edit these setting later, for now, give it a close look and best guess. I find that most every color texture I convert to a normal map requires at least one or two trips back into Crazy Bump to get just right.

image

FIG 6.32 Dialing in the settings for the normal map.

Step 57: Save to a file. When ready, click the Save button and choose Save Normals to File … from the popup menu. Save the file as ETM_GurneyNormals in the sourceimages folder. Don’t close Crazy Bump.

Step 58: Apply the new normals map to the Bump Mapping channel for your material in Maya. To do this, select the material in the Hypershade by double-clicking it. Then in the Attribute Editor, apply the normals map the same way we did the color or transparency maps. With Viewport 2.0 active, the results should be immediate (Fig. 6.33).

image

FIG 6.33 Results of Crazy Bump.

Step 59: Evaluate, adjust, reload. Evaluate visually in Maya. In Crazy Bump, adjust the settings and resave over the same normal texture. Back in Maya, reload the Bump Mapping file, repeat.

Step 60: Repeat for other objects in the room (Fig. 6.34).

image

FIG 6.34 Finished normal maps for the room.

Tips and Tricks

It’s sometimes difficult to tell from far away like this, what the final result in the level will be. It’s even more complex because the results will change quite a bit once the scene is lit. Generally though, gentler is better — especially when it comes to the Intensity setting. The default is a very high 50, when often closer to 5 will yield the most believable results.

Conclusion

And with that we will leave the texturing part of our room. There still are some very important parts of shading our scene that we haven’t talked about — most importantly adjusting the shader type. So far, we have created only Lambert materials, which are always matte materials without any gloss. There are plenty of other types of materials, and some that will be of great use to us in this scene. But most of these other shader types are very reliant on lighting, so we will wait to tweak those in the lighting chapter.

So let’s use the techniques used thus far to work on an organic shape.

Tutorial 6.2 Textures for Organic Forms

In the last tutorial, we assembled textures almost exclusively through image manipulation. We started with textures, and then mixed, matched, and blended them to get a new and unique look that was more than any of the individual source textures.

In this chapter, we will be texturing the little alien we began in past tutorials. This is the work of Jake Green (www.JakeGreenAnimation.com) and he has a much more illustrative style. In this tutorial, we will often be utilizing the techniques covered in the last chapter, but generally, the techniques will be much more illustrative here; we will literally be painting many of the textures in to indicate surface attributes (like specular highlights, and AO darkening). This direct manipulation and painting of textures can really be a fun way to get just the look you’re after without being totally beholden to the textures you can find online or take photographs of.

Preparation

Step 1: Make sure your project is set, the Alien file is open and that you have a snapshot of the alien’s UVs. If you’ve been following along, use your own or if you’d like to match the screenshots of this tutorial exactly, the starting and finishing state of this character are available on the support website (http://www.GettingStartedIn3D.com).

Step 2: Open the UV Snapshot in Photoshop. If you are using the tutorial files, this is the file GameCharacterOutUV.iff in the images folder. Save it as GameCharacterRaw.psd back into the images folder.

Step 3: Prepare the image so the UVs can be clearly seen. Cntrl-click on the Layer 0 and choose Edit > Stroke. Enter 3 for the Width and change the color to white. Create a new layer and fill it with black. Label the UVs as UV Snapshot and the black layer as Background.

Why?

Yes, the colors here are a little different than the last time. It’s largely personal preference — some people like the white UV lines, others black, and others change them depending on the planned texture beneath it. In this case, the screenshots make use of white UVs on top of a black image, so we’ll use that here to match. The key will be to always make sure that the Background is the bottom most layer and the UV Snapshot layer is the top most.

Step 4: Lay in the base green for the screen. Do this by creating a new layer and then choose Edit > Fill and pick a nice alien-esque green (Fig. 6.35).

image

FIG 6.35 Laying in the green basis of the skin.

Step 5: Break up the green field with blended layers. Do this by first finding a nice noisy texture from CG Textures (or elsewhere). Download it, copy and paste it into the GameCharacterRaw file. Be sure this new layer is on top of the green skin base layer and change the Blend Mode to Soft Light (or to taste — there are various Blend Modes that could be used here (Fig. 6.36)).

image

FIG 6.36 Breaking up the green with a noise layer using Soft Light for blending.

Step 6: Limit the green texture to the face. We’ll do this with a Layer Mask. Start by using the Lasso Tool to roughly select the UV faces that represent the aliens face. Then, in the Layers Palette, click the Add Layer Mask button to the green layer. The results should look like Fig. 6.37.

image

FIG 6.37 The results of a Layer Mask (the inset shows what the layer should appear like in the Layers Palette).

Why?

Don’t’ worry about all the brown. For now, it will provide a nice way to break up the other textures we are going to lay down. The core idea here is to work non-destructively and Layer Masks are a great way to do this. From here on out, you can select the Layer Mask and when you paint with black, it will mask out the area, and return it when you paint with white.

Step 7: Use the Layer Mask to return the green to other parts of the UVs where skin should be showing. A nice way to do this quickly but effectively is to use the Lasso to roughly select around an area of UV faces and then use the paint brush to paint the Layer Mask in white … the green skin will reappear (Fig. 6.38).

image

FIG 6.38 Painting back in skin areas by painting on the Layer Mask.

Step 8: Paint in other head details. The method here is to make sure to create a new layer for each big color change (like the brown ridges across the head) and make sure the layer is beneath the noise layer and above the skin layer. Then paint the desired color (Fig. 6.39).

image

FIG 6.39 Painting new color layers that are still beneath the noise material.

Tips and Tricks

Sometimes when painting specific areas like this, it can really help to first select the area using the Lasso Tool — or the Polygonal Lasso Tool as it will keep the texture clean.

Faux AO

In the last tutorial, we looked at having Maya calculate AO for us that we then placed into the texture. There are, however, other ways to accomplish this same look. Jake frequently uses an interesting form of fake AO that produces a quick and effective result without the need for baking.

Step 9: Add AO to the outside of the ridges. Do this by selecting the layer(s) that contain the brown ridges. Choose Layer > Layer Styles > Drop Shadow … Change the Distance setting to 0, turn the Spread up (try around 20%), and adjust the opacity to taste (Fig. 6.40). Do not click OK yet … we need to activate other Layer Styles yet.

image

FIG 6.40 Settings for the Drop Shadow Layer Style.

Why?

This Drop Shadow without an offset will make a sort of halo of diffuse black around the brown stripes. This will simulate AO on the head at the edge where the ridges rise off the head.

Step 10: Activate Inner Shadow to add faux AO to the brown areas. The suggested settings are shown in Fig. 6.41.

image

FIG 6.41 Adding faux AO to the inside of the brown stripes.

Step 11: Activate Inner Glow. The suggested settings are in Fig. 6.42.

image

FIG 6.42 Further sculpting with painting using Layer Styles.

Step 12: Paint in additional highlights and faux AO. Do this by creating a new layer and then using the Paint Brush tool with very low opacity/ flow (set these at the very top of the Photoshop interface), gently brush in additional details to represent places where the light would be caught (i.e., top of the brows) or AO would appear (Fig. 6.43).

image

FIG 6.43 Painting in AO and highlights.

Tips and Tricks

Be patient. It’s much better to paint in too delicately in the early passes with very low opacity painting than to make the character look clownish with too heavy handed light and dark strokes. Remember, the character shouldn’t look painted.

Step 13: Repeat steps 8–12 for areas like the hand. Remember the trick of the fake AO using Layer Styles. The final results should look like Fig. 6.44.

image

FIG 6.44 Laying out hands with additional colors and faux AO.

Textures as Painting Basis

Going back to the techniques examined in the last tutorial, let’s use some textures download from CG Textures (or taken yourself) with Layer Masks to create the texture of several parts of the costume.

Step 14: Use the texture/Layer Mask technique with a metallic texture for the chest and back plates (Fig. 6.45). Remember the basic idea here is to copy and paste into the scene a base texture, then use the Lasso Tool to select around the area of the UV faces this texture should be applied to and click the Add Layer Mask button in the Layers palette.

image

FIG 6.45 Chest and back plate.

Step 15: Continue for things like the shirt. Use a base texture with a Layer Mask to keep the texture confined. Then, go in and gently paint in highlights and AO as desired (Fig. 6.46).

image

FIG 6.46 Texturing out the shirt with a base texture and painted AO and highlights.

Step 16: Repeat for boots and belts. Figures 6.476.50 show screenshots along the way. All are using the same techniques laid out in this tutorial.

image

FIG 6.47 Start of the boots.

image

FIG 6.48 Finished boots with highlights.

image

FIG 6.49 Cummerbund and belt.

image

FIG 6.50 Pants. Notice the painted highlights, shadows, and folds.

Step 16: Save the multi-layered image (Fig. 6.51). Remember this is probably saved in your images folder.

image

FIG 6.51 Final multi-layered textures.

Step 17: Use File > Save for Web & Devices to save out a GameCharacterColor.jpg version of the texture to the sourceimages folder.

Implementing into Maya

Step 18: Back in Maya, create a new Lambert material for the alien. This time, try right-clicking on the alien and choosing Assign New Material … This will apply the new material to the alien and should open the material in the Attribute Editor.

Step 19: Name the material Alien_Mat.

Step 20: Define the color channel to use the newly saved GameCharacterColor.jpg (Fig. 6.52).

image

FIG. 6.52 Finished alien texture.

Conclusion

There is still work to be done on the alien. The eyes need to be completed (hint — try pulling the eyes off the character style sheet for a start), and there is more history that could be done. Think of ways that you can tell a story with the textures that the little alien has on his clothes, skin, and armor.

But the techniques are all laid out now, so you have the tools at your disposal to begin to realize your vision of the narrative.

Wrapping Up and Moving On

Texturing is an important part of a 3D project. It’s critical to beginning to make spaces look like someone has been in it and making characters look like they lived before we saw them. But texturing is at its most effective when it ties into its sister techniques — lighting.

Any surface attribute on a texture is heavily dependent on the light that is shown upon it. Great modeling and texturing work can be completely ruined with shoddy lighting. And even mediocre modeling can start to look like a million bucks with a clever lighting scheme. In the next chapter, we will start looking at Maya’s lighting and rendering mechanisms. We’ll explore the actual instruments and then look at how to use them in our set. Finally, we will look at some character lighting strategies.

Homework

1. Finish the eyeballs of alien.

2. Add further narrative to the alien by altering his texture to let us know where the alien comes from and what he does for a living.

3. Texture the high poly mesh given as challenges in past chapters.

4. Use the techniques covered in this chapter to finish out the textures for Escaping the Madness. Be sure to give each room a clear purpose.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset