Join Adam Crespi for an in-depth discussion in this video Utilizing render passes and ambient occlusion, part of Learning to Texture for Games.
I have taken my wall panel and massaged around some of the geometry. I use the Sculpt tool here on the plaster that goes between the timbers. I have moved around some of the vertices using Soft Select and the Sculpt tool as well. I even smoothed out this mesh a little bit, applying up mesh smooth twice to bring up the tessellation for sculpting. This way when I bake out a normal map I have got some good value going on. For the baking then I'll go to my Render settings and into the Render passes. These provides scene passes or extra images we use for compositing in a film and visual effects workflow.
Using the mia_material_x passes allows us a lot of flexibility in terms of what we're outputting. To start, I will create Render Passes, pulling up to Create Render Passes window and adding in Depth Remapped, Camera Depth, Object Normal and, just so we can take a look at it, Specular; we will see if that works or not. I will Create and Close, then I will associate these passes with the scene. And finally create a contribution map for the Master Render layer. I'll take these passes and associate them with it.
Here is what each one does. The Depth pass records depth from the camera as a grayscale. Straight depth is infinite in the scene. Whatever is close as white whatever is absolute far as black and anything else is a gray. Depth Remap then allows us to remap those depth values between a near and far clipping plane on a camera, set in scene units. The normal cam will output a tangent space normal depending on how we are working and we get a dropdown here if we need. Camera Space will give us tangent space for use.
Specular then, will put out a specular only pass that shows just where the highlight should be on this object. I will choose Display, heads-up display and Object Details. I will select my beams, which I have unified together and look at the distance from camera. This is in centimeters even though my units are in inches we need to look at this in centimeters. And so what I will say in this in my Depth Remapped pass is that, that distance needs to be around that value. Here in those passes then, double-clicking in Depth Remap takes me to its attributes and I will put the near clipping plane at 350.
I will put the far out at 450, to make sure I catch all of it. What I've got here also is the minimum and maximum buffer value that's an RGB here expressed as a luma. This is going to give me a height map for parallax. So that in addition to normal I can tuck this in the Alpha and get normal and parallax so when I go by this wall it looks correct. Project setup in this workflow is very important. As you can see here I have set my project and it's going to go into the Master Render layers, Render Pass and then finally make those IFFs.
I'll check Z depth as well, scroll up and name this file, which I will call wall1. I am going to render out IFFs. There are 16-bit files and they travel with an alpha and Z depth. I will give it one last test in IPR and see if this works. This looks pretty good; it's maybe a little gray so I might balance the lights out a little bit to get a little more value. But for the first test I think it will hold up nicely. We can see in here I am getting some shading in the dips and valleys in the plaster and the normal map will have good range and drama in it.
I will make sure under Options I choose Test Resolution and Render Settings and I'll hit Render. My Render finished and I can check out how the Render passes looks straight from the Render view. I will choose File>Load Render Pass and see how they look. Some will show better than others. Depth Remap shows up as a mask and the reason is because we are only seeing the color; we can't necessarily see the depth in this particular browser. We can look at the normal. I load the Render Pass the normal cam and there is this terrific normal map rendered out.
Here is the specular, and again this looks great; this would be a good specular map to lay in or put in the alpha to diffuse. I am going to render out one more piece and that's an Ambient Occlusion. I will use an override to make this work easily. I will press Ctrl+A to go my Channel box and down here in the bottom right on my Render layers I will right-click on the Master layer and choose Overrides>Create New Material Override>Surface Shader. Back here in the attributes, I'll name this surface shader AO general. As a typical workflow, I will have different AO materials named for what they're doing.
For example, this will be used on most everything. If I have a surface like a glass or a glossy finish that will gather less occlusion, it will get less darkness in the corners. I may make a separate one and call it AO glass. In the out color then, in the texture, I will put in from the mental ray textures, mib_amb_occlusion. I will bring up my Render settings and one of the first things I'll do is name that output. In case I accidently hit Render again it won't overwrite my previous work. Now I will pull up my IPR and see how this looks.
It's neat, but it's very black and here's why. I'm still running that photographic exposure and that's going to affect my occlusion. For running an occlusion like this we want it to be clear. I'll pull up the Render settings and in the Render settings under Features I have got switches for turning off and on things I am using. I am going to turn off Final Gather and turn off Lens Shaders. I don't care if the physical sky is still on or not or the light because occlusion is only affected by geometry. Now I can see my IPR updated nicely.
I have got occlusion or darkness gathered in the corners. It's going to ground everything. I will lay this over and I can even use the occlusion as the foundation for dirt for rust if I need. This will help bring a gravity, really popping out the work. I think I am ready to render, because I like the way the occlusion looks. What I will do though is stop my IPR and in the Render settings under the Passes, turn off the Contribution pass. I don't need it for this particular one. I just need the beauty pass the Ambient Occlusion. I'll hit Render and this should go nice and quick.
As a side note also in occlusion, you can up the samples if you like; 16 may be a little low and get me some dots. I'll try 32 and I will leave the bright and dark values alone. With the bright and dark values of black and white I get white in clear spaces and good grounding corner darkness tucked in the places we would expect. I can always push those levels around in Photoshop if I need. My render is finished and although it looks all white out here I actually have an alpha channel clip nicely around. I will open up Photoshop and pull these layers together in one PSD.
Here in Photoshop I am going to open up the images. I will go in to the Images folder in the project and into the Temp directory. Maya puts images there when rendering singles or stills. In that directory then, I have folders created for each of my Render passes. There is an automatic master beauty pass and then the ones I chose. I will pull open the master beauty and there's two images that I need. Wall 1 is the color, Wall AO is the AO. I'll pick both and hit Open. What I will do is take each of these and drag them over while holding Shift into one document.
I'll tear off the AO, drag, hold Shift while I drag and that lays right on top, then I can close the AO pass. I'll pull open and insert the other pieces the same way. I've dragged in the normal spec and occlusion into my color layered PSD. Its still shows as an IFF because I haven't saved. And now I need to pull in the depth. When I go to open up the depth here in Photoshop though I may get an error. Photoshop doesn't like it because Photoshop doesn't read in Z depth. What we need to do is open this in F check, extract the Z depth as a luma in a TARGA or TIFF for example, and open it that way in Photoshop to be able to grab that depth for parallax and put it into the Alpha.
Here is my Wall 1 depth remapped. When I double-click on it, noting its got the camera showing it opens automatically with FCheck. I'm going to see maybe, maybe not what I expected. What it shows me is that my remapped values were too light. I'm not getting the Z depth I expected to see. So that may require a re-render of this one. But I will check on the straight depth and see how it looks first. This is better, there in the Z buffer, not RGB or Alpha but Z, I can see the depth, the distance away from the camera of my timbers and plaster.
I will choose View and Full Resolution. This way I'm not saving a scaled-down version. Now I will choose File and save image. I'll save it in that same folder, call it depth and save it out as a target for example, repurposing the Z buffer data to RGB. Now in Photoshop, I can open that depth image and pull it into my layers. There are all the pieces required to build up my textures. I have got my Depth, my Normal, my Spec Occlusion and Color.
I'll start by layering the occlusion over the color. Switching the occlusion layers Blending mode to multiply really pops out the depth in those pieces. If you like, you can color tone the Occlusion, pressing Ctrl+U for Hue/Saturation, colorizing and moving the hue around without shifting Luma. I am going to introduce a rich brown in here so it's got some good depth along the sides. Now I will take both of these gray scales and tuck them in the Alpha's, one will be parallax and one will be spec. I will turn on layer 2, select all, copy, Ctrl+C and in the Alpha channels paste it in.
We may see extra alphas going on here, depending on how it was encoded and what we saved out. I can just simply use them and name them as I need. This will be my parallax map and again I will select all, Copy and Paste in. Its fine to have multiple alphas as we can be weed these out later when we are saving out single flattened images. It's ready for cropping and placing on a text or sheet. I can take this and assemble it, render out the rest of the pieces with the same lighting, tune their occlusion the same way and stack them all in. I will also make a section of stone wall and finally the door and doorframe.
That way I have got a whole medieval village worth of texture pieces ready to go.
- Introducing texture tiling
- Stacking polygons in an unwrap
- Establishing base colors
- Establishing realism with age and wear
- Cleaning up seams and joints in textures
- Creating dents and scratches
- Working with normal maps
- Sculpting detail
- Baking occlusion for rust and dirt
- Working with value and color for incandescence
- Faking reflection
- Painting skyboxes