Displace mesh vertices at render time.
- [Instructor] Displacement mapping is a render technique to deform mesh vertices based upon a matte input. Here we will use it to apply a high resolution heightmap to a a landscape. Displacement in Arnold doesn't display in the viewport. For convenience, I've created a proxy object using the texture deformer, so that we can get an idea of the composition. Let's open up the Hypershade from the status line. In the browser section, select the two materials labeled terrain.
I'll drag my mouse across those two. And in the graph toolbar click Input and output connections. Now we see the graphs for those two materials. One of them is applied to the proxy object and the other is applied onto the plane that we're going to deform. Let's do a rendering of the proxy object with low level of detail, so that we can see the improvement after we add the Arnold displacement map. In the Arnold menu, choose Render.
The first time you launch the Arnold RenderView, Maya may hiccup for a moment and you may or may not get a progress dialog. It might look like Maya has frozen, but just be patient. It's probably just mipmapping textures in the background. What is mipmapping? It's a way of encoding bitmaps that saves coding and render time. Multiple copies of the bitmap are saved at different resolutions inside a single file. When the texture is rendered in a scene, it's size in the frame determines which size within the bitmap file should load.
If the texture is small in the frame then a lower resolution version can load, saving memory. Arnold mipmaps all incoming textures automatically. Maya may also store the mipmap files as .tx documents, in the same directory that the original file is located. If you've noticed any .tx files in your source images directory, those are the mipmapped version generated by Arnold. This will increase disk space usage, so don't be surprised if Arnold approximately doubles the amount of disk storage needed for your textures.
Generally you don't need to think about .tx files, because they are generated automatically. When you change certain properties of the file node, such as the color space, then the .tx files will regenerate automatically. Just don't panic if Maya seems to freeze, especially if you've got very high resolution textures. It's just the auto-tx routine running. If you want more control over the .tx files, there is a window for that, found in the Arnold menu, under Utilities, Tx Manager.
This shows me that I have three documents referenced in this scene and they all have .tx documents associated with them. That's all about .tx files. Back in our Arnold RenderView, once that has completed we can see that there is some jagged, rough geometry, because it is a proxy object. Let's store a snapshot of that and close the Arnold RenderView, just to be safe. It's a good practice, actually, to build your shader network and make all the connections with the Arnold RenderView closed.
Then once you've built the shader network, open the Arnold RenderView, just to make sure that it is refreshed. In the display layers, underneath the Channel box, you'll notice that we've got a couple of terrain layers. The first one is TextureDeformLayer, that's the proxy and it's currently visible. Let's make it invisible by clicking the V button. Below it is the ArnoldDisplaceLayer. Let's make it visible. It's just a simple plane. Over in the Hypershade we can zoom in a little bit with the mouse wheel, on the terrainDisplace_aiStandSurf, which is the material currently assigned to this plane.
In Maya, displacement works through the shading group, which is a go between node that connects materials to objects. We've got a displacement shader input there. We can plug a map directly into that and it will work. If you do it that way you can adjust the displacement parameters from the object shape node. But the other way to do it is through a Maya displacement node, which will take priority over the object shape node.
The displacement node provides key features, such as vector space. Let's create the displacement node. In the Hypershade Create window, go to Displacement and click Displacement. The node is created and it also comes with it's own shading group, which we don't need, so select displacementShader1SG, and press Delete to delete it. Then we'll connect displacementShader1 to terrainDisplace_SG.
We can select displacementShader1, and we've got a Displacement output here. Click and drag on that, over to the Displacement Shader input of the shading group, and that connection's been made. I've got a texture already prepared for this, and it's found in the Textures tab of the browser. And it's called terrain_heightmap. Middle mouse drag that over into the graph. We want to connect it to the Displacement input of displacementShader1.
We need to figure out which output, of the file node, we want to use. The displacementShader has a standard floating point displacement input, and that's what we want here. So we need to use a floating point output over here. The Alpha channel is no; there's not Alpha channel in this file. So open up Out Color and click and drag from Out Color G, which is greeen, over onto the Displacement input of displacementShader1.
We're just extracting one channel here, to feed the floating point attribute. We can tidy up our graph by just clicking on Rearrange graph. And zoom back in a little bit here. Let's do another rendering. Arnold, Render, and it seems pretty flat. So we need to make some adjustments. Let's select the displacement shader node and open the attributes, if you need to, with Ctrl+a. Let's get this visible in the Arnold RenderView at the same time.
We've got a scale parameter, so increase that. Let's try a value of 10, see what that does. It moved a little bit. How about 100? We've got some displacement. Let's try 1,000 then. Now it seems like we're actually underneath the surface. So we can shift that surface up and down using, in the Arnold section, the Scaler Zero Value. Bring that to a value of 0.4, and it just shifts, or biases the texture up and down.
We've got that set up now. You might need to adjust the Balance Padding if you don't see what I see, here on my screen. Sometimes Arnold crops the displaced surface, based upon the outline of the undisplaced surface. To fix that issue, increase the Bounds Padding. I'm not seeing the issue right now, but just for safety sake, I'm going to set Bounds Padding to 100. And that's the basics of how to apply a displacement map using Arnold.
- 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