Shading nodes

From LightWiki

Jump to: navigation, search

by Dave Jerrard

Each of the shading models - Minnaert, Oren-Nayar, and Lambert - were designed to mimic certain types of surfaces. Occlusion, Translucency and Theta are special shaders that work best whem combined with one of the other three. But which shaders should be used for what? There's no rules set in stone about how to use them. But here's some guidelines on where & when to use them. Lambert is a theoretical perfect surface shader (and the model is actually about 200 years old), where light hitting a surface is diffusely reflected equally in all directions. About the only surfaces I can think of that are close to this are wax and plastic. This explains why untextured surfaces rendered using Lambert shading look so plastic. Lambert also happens to be the built-in shader that LightWave (and almost every other 3D renderer) uses, unless you specify something else. If your object is plastic, then Lambert will do it about as right as it can be done.

Minnaert (more precisely, the Minnaert-A mode or implementation) was designed to replicate the shading of the moon (but not hte only one), so it's often called a moon shader. I believe Gaffer uses a similar model when you use its Diffuse Roughness setting. LightWave's own Diffuse Sharpness (originally called Sharp Terminator) is also an attempt to try to simulate this. Minnaert's good for anything that's got a particulate or porous surface, like the moon, which is covered in dust. These surfaces can cause a lot of light to back-scatter. Good examples are metal oxides, brushed metals, dust, stone (particularly sedimentary ones like sandstone, shale, slate, and to a lesser extent, marble and granite, which would be better done with Lambert), unfinished wood, matte paint (dry of course), and anything else like that. If it has a fine rough surface or feels powdery, then Minnaert's your shader.

Minnaert B, the second option in the Minnaert shader is better for fibrous surfaces, especially where the fibers tend to be mainly perpendicular to the surface, like velvet, velour, or even carpets. It's pretty close to Oren-Nayar, which is frequently called a velvet shader. In fact, these two shaders are frequently interchanged with moon and velvet shader, where Minnaert is also called a velvet shader and Oren-Nayar is the moon shader. There's a lot of variations of these, and most other shading models, and the line between them can get a bit blurry.

Oren-Nayar (at least one or two variants of it) is designed to simulate fuzzy surfaces, again, mainly for surfaces where the fibers are standing perpendicular to the surface. Less light is reflected back from the surface the more perpendicular the viewing angle becomes. This is simulating the effect of trying to look at fibers edge on, where you can see very little surface area on them. As the viewing angle becomes more acute, you would see more of the sides of these fibers, and thus, more reflected light from them. Oren-Nayar is good for the same things as Minnaert-B. If it's a fibrous surface, then you'll want Oren-Nayar, or Minnaert-B, depending on taste. This includes cloth, wood, and skin (lots of little hairs on skin, and it's also slightly dusty & porous, so Minnaert can work too), and anything else like these.

Oren-Nayar and Minnaert have several variants, and I don't know which variants are being used in nodes currently. It seems that in nodes, Minneart can give better velvet shading than the Oren-Nayar version, and vice-versa... Oren Nayar can give you a pretty nice moon shading. But like I said, there's no rules set in stone. These are just guidelines.

Occlusion isn't really a shader like the ones listed above. It doesn't actually shade the surface itself, but gives a value from 0 to 1 that indicates how much of the backdrop is visible to the surface at any point. This value is then generally used to control other nodes, like specifying that recessed areas of the surface would be less diffuse or reflective. On its own, because it's a scalar node and doesn't support color vectors, it will only shade an object in greyscale, with white appearing on the surface where there's no other geometry between it and the backdrop (or maximum range), and black meaning that the backdrop cannot be seen at all from that point (or there's something blocking the surface within the range specified in the node). Because of the way a surface appears with this, it's frequently used to simulate radiosity. In fact, with Backdrop Radiosity and a white backdrop lighting a white, untextured object you would get virtually the same results as with this node. But where the shading of an object using Backdrop Radiosity is affected by the color of the backdrop, the shading using this node alone will always be greyscale, and it completely independent on lighting, light color or backdrop color. You'll get the same result with a black backdrop as with a white, or blur, or HDRI environment, etc.. Generally, you'll use this as a controller for another node, so its uses can be for anything really.

Translucency is basically the same thing as the surface attribute of the same name, but done up as a node, which lets it be controlled in more ways, including a separate translucency color.. One nice thing about the Translucency node is that it offers two modes or ranges. When set to 90 degrees, it works just like the familiar Translucency channel, where the surface is most brightly lit when the surface is perpendicular to the light rays, and not lit at all when the surface is edge-on to the light. Basically, it's the same as the Lambert diffuse shading, but on the sides of the object that face away from the light. On a sphere, with both diffuse lighting and translucency, this results in a dark band along the terminator, where the surface isn't facing the light. Wit the 180 degree range, this band is gone. Now, the surface, when using only Translucency, will be brightest where it's facing away from the light, 50% as intense along the termnator, and 0% at the point that's facing directly toward the light. This node is best used with another shader since the shading it generates isn't all that useful on its own. It will actually tend to look more like a negative. When combined with Lambert, Oren-Nayar or Minnaert (usually with a Mixer or Add node), this shader does a relatively good job at translucent surfaces, like paper, leaves, lampshades, or anything else that's thin. The color and amounts can both be textured, so you can use this to fake underlying textures, like paper grain, or veins in the surface, that are only visible when backlit.

When you need a little more accuracy for translucent shading, Theta can step up. It's another form of translucency, but with a bit of ray tracing accuracy added. It's also a borderline subsurface shader. It uses an Index of Refraction to control how light affects the back side of the object, and also lets you specify how much of a spread that light has. This makes it better suited to thicker objects, like candles or plastics. The amount of light that is visible through the object is based on the viewing angle as much as the lighting angle. If the object is directly between the camera and the light, it will be lit the brightest. As the viewing angle brings the object out of line, the illumination decreases. The range value can widen this area of visibility. Because of this viewing angle dependency, this shader is good for thin materials that would have a certain amount of forward scattering. Again, leaves will work ok for this, but one really good example would be dust on a windshield. If you ever looked through slightly dusty glass, into the sun, you'll get the idea. Even though the glass looks clean from other angle, when you're looking towards the sun through it, it's hard to see through all that brightly lit dust. Clear and translucent plastics, glass (great for frosted glass), and some liquids will make good use of this shader. It's also good for thin membranes, like bat wings, where you can have a texture plugged into the Color input of the shader, which will only show up in a specific viewing angle. Again, it's usually best to use this with another shader.

As for specularity shaders, they're a bit less specific. They're mainly variations on a theme where one is trying to improve on what's already done in another. Phong is pretty much the standard again. It gives a smooth highlight, which, like Lambert, is actually pretty close to what plastic does. If the surface is not quite a mirror finish, then Phong will do a good job at it. Glossy paint, plastics, laquers, and polished metals will look pretty good with Phong highlights.

Blinn is very close to Phong, but with a slight difference. For back-lit highlights, where the light is nearly behind hte object and is still casting a highlight on the surface, Phong tends to spread that highlight out across the surface. while Blinn keeps it the same size as it would with the light in front of the surface. The highlight remains round, rather than spreading out. Other than that, they're virtually identical. In use, I would use Phong for surfaces that are supposed to be a bit drier or worn. The spreading of the highlight at these angles lends a bit of a dusty look to the surface, where Blinn gives it a cleaner, freshly polished, or even wet look.

Cook-Torrance has a different look. At higher glossiness settings, the highlight becomes a hard-edged disc, which is good for glassy, or more mirror-like polished surfaces. This is great for car finishes, glass, water, chrome, or anything else you would expect to see your reflection in. At lower glossiness settings, the shader gives really nice highlights for other materials, like unpolished metal, or frosted glass. It creates a very wide diffused highlight, which can be really useful for less reflective surfaces like wood, stone, skin, or other surfaces that don't have much of a reflective quality.

Anisotropic is designed for surface that have a surface that has a series of micro grooves in it. The best example would be brushed metal, like the bottom of a copper pot or the big shiny silver dial on a stereo, stainless steel, or the data surface on a CD. It's also good for surfaces with parallel fibers on them, like spools of thread, Christmas ornaments, ribbons, wood, and even hair. It lets you customize the shape of the highlight by independently controlling the width & height of it. If the surface has any kind of grooved or fibrous texture to it, this shader can help make it look good.

These nodes are actually just a small sampling of the various shading models that have been developed over the past several years in 3D rendering. Over time, I fully expect the list of shaders available in nodes to grow. For example, there are dedicated velvet shading models that have been developed by several people. Other good moon shaders include the Lommel-Seeliger and Hapke models.

Views
Personal tools