Shade an object based on surface distance.
[Instructor] Ambient occlusion is a very powerful and versatile effect that can be used in many circumstances. It's original purpose to block ambient light is no longer needed in the wonderful world of a brute force global illumination renderer such as Arnold. But ambient occlusion is great for special effects based on distance among surfaces. In this case I'd like to employ it in a shader network to make the recessed areas of this picture frame darker and rougher, or less reflective.
Picking up from the last movie, I've already got the attribute editor, the Arnold render view, and the node editor open. Displaying the shader network for the standard surface material applied to the picture frame. It's got a bump map. For clarity in the demonstration, let's disable the bump effect. Select the bump node and in the attribute editor, set the bump depth to zero. Also for testing, let's change up the parameters of the AI standard surface material, select that node, and in the attributes, set the diffuse weight to its maximum of one, then metalness to zero, and also set the specular weight to zero.
A perfectly diffused surface like this will make it easier for us to visualize the ambient occlusion effect. I'll create the node in the node editor. If you're using hibershade, you can do it from the create window, and the section you want to go for is Arnold/shader/surface/AI/ambient occlusion. But here, if we know that we're looking for ambient occlusion, we can just do a quick search, click in the node editor window, and press the tab key, and tap in "ambient".
And I only have to type in "amb" and the node I'm looking for immediately appears. Click on AI/ambient occlusion, and the node is created. It's also got a shading group node. We don't need the shading group, so select that and press delete on the keyboard to delete it. Select the AI/ambient occlusion node in the node editor and rename it in the attribute editor, we'll call it "diffuse occlusion". We want to connect the output of the occlusion node to the base color of the AI standard surface.
And one way to do that is from a pop-up window. In the node editor, I can click on the output of diffuse occlusion, and I get a little pop-up menu, and I'll choose out color, out color. Then I grab the connection wire, go over here to the AI standard surface input and click, and I get a pop-up menu once again that just says "other". So I'm pulling down the mouse and I choose "other" and I get a pop-up window, just click on "base color".
And now that connection's been made. If you want to view all of the inputs, you can do that from this little menu up here, or from the keyboard shortcuts. And just use one, two, three, and four in order to see different options. I'll set that back to connected mode with "2". In the Arnold render view, we see a very subtle effect of the ambient occlusion, let's adjust those attributes. Select the occlusion node, the most important ones are near clip and far clip.
But in order to see this most clearly, let's use bright primary colors for the white and black colors here. Click on the white color, set that to green, click on the black color, and set it to red. Now we can see that a little bit more clearly, if we want a faster update, we can use the crop region tool. Let's get in closer, can do that in the view port over here, I can just use alt and right mouse button and dolly forward, and alt middle mouse button to position.
And I've zoomed in a little bit here, and additionally to save on render time in the interactive window, use crop region and just drag a rectangle, and only that area is going to update. Back in the node editor, we've got the diffuse occlusion node selected, we've got its parameters displayed in the attribute editor, and now let's adjust those near and far clip. And because this is a small object, I want the near and far clip to be in the range of ones.
The near clip, bring that up a little bit, let's give it a value of 3.5, and far clip, we need to bring down quite a lot, because it's set to 100 units, so I'll drag that down into the ones, and if I have issues with range here, I'll just type it in, the value of six. And it looks like we don't have a good effect yet, but we have some more options here, namely invert normals.
Turn that on, and it gives us a pretty clear gradient across the surface. Additionally, turn on self only because if self only is off, then the nearby objects will influence the ambient occlusion so turn self only on! And now we've got a really good effect here where we've limited the shading to just the recessed area of the picture frame. The other attributes at the top of the ambient occlusion node are not quite as important, the samples of course is the quality, and I'm getting a good result here with a default of three.
Spread is the shape of the sampling pattern, and for accurate results, you probably want this set to the default of one, which is a hemispherical search pattern around each normal. Falloff makes the effect diminish more quickly with distance and I don't recommend it in this case, if I increase the falloff, I actually lose my effect pretty quickly. So I'm going to leave that at zero. So we've established a clean gradient based on distance, let's restore these colors back to their default, click on the white color, and set it to white, click on black, set it to black.
And back in the Arnold render view, we can jump out of crop region mode, and that's how to use ambient occlusion to shade an object based upon distance among surfaces.
- Arnold rendering concepts
- Lighting with Maya and Arnold lights
- Controlling exposure
- Filtering light with Gobo
- Light attenuation with Decay
- Image-based lighting with Skydome
- Exterior daylight with Physical Sky
- Arnold Standard Surface material attributes
- Mapping material attributes
- Rendering refractions
- Mesh subdivision and displacement at render time
- Shading effects such as ambient occlusion and vertex color
- Camera effects such as fisheye and depth of field
- Animation image sequence rendering