In this collection of lessons, we will learn about a wide variety of useful Hypershade rendering nodes. These lessons include using the Displacement node to create displacement-mapping effects, using the Layered Texture node to create complex multi-layered textures, using the Optical FX node to add realistic lens flares to Maya lights, using the different Switch Utility nodes in order to add realistic variation between many objects using the same shading network, plus several other useful Hypershade nodes. Software required: Maya (all versions).
Kyle was one of the first authors for Digital-Tutors (now a Pluralsight company) and has been a part of the team for over 10 years. Kyle began his career in computer graphics education as a college instructor and worked as a Digital-Tutors rendering tutor and curriculum manager since 2002.
Introduction and Project Overview In this lesson we'll take just a few minutes to explore the Maya Displacement node. OK, so the Displacement node is really the node through which any sort of a Displacement Map is connected. So first things first, what is a Displacement Map? Let's take just a moment to actually explore this little concept. If you take a look at the Blinn material that I already have in this scene, we can take a look over in the Textures tab in our Hypershade, and I've already added in a grid. All right, now, just for illustration's sake, I'm going to connect this as the color of our Blinn, just so we can see what this grid texture looks like on this Torus geometry. OK, and this is the result that we get with the grid texture connected in as a Color Map. Now, a Displacement Map will actually look at black and white values of any sort of a texture that we plug in and actually use the luminance values, or these black and white values, to determine how geometry should be pushed or pulled, in other words, displaced. So it'll actually take the areas of brightness, or any place that is white, and actually pull these areas of the geometry up. Any place that's black actually gets pushed down, and any grayscale values in between get elevated accordingly. So what we would actually do is use this Displacement Map as a way of pulling out these areas that are currently highlighted in white. All right, now, just to illustrate this, let's go ahead and now take this grid and just disconnect this, now that we actually know what it is that we are trying to achieve. Now, the Displacement node is found a little bit further down underneath the Volumetric inside the Displacement area. So if we were to add this in and take a look at the actual Attributes, you can see we really don't have any Attributes to speak of, other than Displacement. So really this is meant to act as pretty much just a pass-through node for the Displacement calculation to start. And for most circumstances, you actually don't need to manually add this node through the Hypershade. A lot of times Maya will actually add this node automatically whenever you try to connect a Displacement Map. So if we were to take this grid and middle-click onto the Blinn, connect this as the Displacement Map. You can see it will automatically make the Displacement Shader for us, but you'll also notice that it's actually not connected to the Blinn. Well, it actually is, but it's connected to a node that's not currently visible in the Hypershade. It's actually connected to this Blinn's Shading Group. So if we were to take this Blinn, and take a look at both the input and output connections right up here, we can actually see this Blinn's Shading Group, and we can see that the Displacement is actually connected to the Shading Group. All right, and that's exactly what needs to happen, and Maya will automatically make this connection for us whenever we try to connect it to the Blinn. An alternative way of actually connecting the Displacement Map would be if we were to go to the Blinn, and take a look at the input connections for this, and take a look at this Blinn's Shading Group directly, which is the same node that we have here. You can also connect the Displacement material directly from here. All right, so once we have the Displacement connected, we'll now begin the Displacement calculation at render time. So this is what we had before. Let's just save this for comparison and re-render. And once render is complete, depending on the type of image, or the Map that you're using as your Displacement, you may wind up with something that looks like this. And in my case, it looks like the geometry has, pretty much, exploded. Believe it or not, this is actually the correct result. All we need to do, though, is actually go into the Displacement Map and start to tone down some of these values, so that these areas that are being pulled out are not being pulled out quite so intensively. So let's go ahead and close this out. We can actually control the Displacement effect from this texture map that we're using. So we can control this in a couple of different ways. If we are using something that is just a pure black and white image, or some kind of a procedural texture, which is what we have here, we could just start to tone down the values of white, so that way these areas of the Torus that were previously covered in white are not being pulled out quite so far, which is what we're seeing here. So we could just simply lower the luminance values, and start to get a much more subtle effect, or we could also control this through the Alpha channel, or the Alpha Attribute. So this can be found underneath the Color Balance of this grid texture, or really any Maya texture has the Alpha property. Now, if you have the Alpha Is Luminance checkbox turned on, we can actually adjust the Alpha Gain and start to control our Displacement height through here, because if you take a look inside the Hypershade, it's actually connected this grid's Alpha to the Displacement Shader. So in this case, we can now just lower the Alpha Gain. We'll drop it down to something like 0. 100. You'll notice here in the grid preview, it doesn't look like anything has changed, but now if we were to re-render this, we should now start to get something that is much more subtle. And now you can start to see that we have a result that is much more desirable. In other words, much closer to what we would expect to see. So these areas of the Torus, like I said, that were previously highlighted in white, if we were to view this as the Color Map, now by using the same grid as the Displacement Map, it's pulled those areas up and actually elevated those. And it really is truly elevating these areas of the geometry. If we were to take a look at things like shadows, you can see that we have these little raised areas that are actually casting shadows along the Torus geometry. And this can be a very quick and easy way of achieving certain types of effects that otherwise would be much more time-consuming to try to manually model in. Now, depending on your geometry that you're using, you may not always wind up with a clean Displacement to begin with. Now, there are a few Displacement Attributes that can be found on the geometry of your object. So if we were to select this Torus geometry, press Control + A to open up with Attributes. If you take a look inside the geometry's shape node, you should have an area for Displacement Map. So by default, we have these Initial and Extra Sampling Rates. This is determining exactly how many times the geometry will be subdivided at render time. Depending on your particular scene, you could either raise or lower these. If you find that you're getting really good results already, you can maybe start to lower these values, and start to shave off a little bit of additional render time. So just to illustrate, if I were to really lower these values to something like one and one, save this for comparison and re-render, we'll find that our render times are much, much faster, but at the same time you can see that our displaced results are a lot noisier, a lot chunkier, and overall, not really what we would be going for If you compare this to what we had before. So again, depending on your particular type of geometry or the results that you're getting, you can either raise or lower these values to start to get a little bit cleaner Displacement effect. Although, keep in mind that as you start to raise these values, you'll start to significantly increase your render time, and possibly start to introduce some memory issues and just overall stability. So really be careful with how far you take these values. Really start to use caution whenever trying to increase these. All right, so that's a look at how we could utilize the Displacement features in Maya.