PDA

View Full Version : What those shader nodes are good for.



Dave Jerrard
08-16-2006, 10:12 AM
I figured I'd make a new thread for this, rather than risk hijacking the original thread (http://www.newtek.com/forums/showthread.php?t=55441) in which questions arised about the uses for the various shading nodes. I'll just cover the Diffuse Shading and Specular nodes since these seem to be the most confusing for people.

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 surfaces that have a series of micro grooves in them. 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.

That should do for now. I suspect we'll be seeing some interesting tests posted here. I look forward to them.


He Who Will Blame His Keyboard For Any Typos That He Missed.

Simon
08-16-2006, 10:22 AM
Great explanations Dave! Many thanks.

warrenwc
08-16-2006, 11:44 AM
Thanks from he who has copied that into his documents folder.
Next could you explain four dimensional vector transformations? Please?:)

colkai
08-16-2006, 01:47 PM
Ahh, the man is a font of knowledge.

Many thanks Dave, yet another virtual beer to add to the tally. :)

Dave Jerrard
08-16-2006, 01:58 PM
Ahh, the man is a font of knowledge.Naw. Just regurjit.. regurgurg.. puking up some of the crap that I've been reading on Wikipedia and this site (http://www.the123d.com/tutorial/general4/reflections2-1.shtml) lately. :)


He Who Hates When He's Almost Sure He's Spelling Something Wrong.

Dave Jerrard
08-16-2006, 02:01 PM
Next could you explain four dimensional vector transformations? Please?:)Only when I get a 3D monitor. :)

He Who Has Yet To Publish His 'Snow From The Moon' Theory First.

BazC
08-16-2006, 02:31 PM
Very useful info, cheers Dave!

Lewis
08-16-2006, 03:10 PM
That should be put (expanded if possible also) in 9.x Addendum Manuals :).

Thanks Dave

Penforhire
08-16-2006, 03:17 PM
Amen!

nomad108
08-16-2006, 04:53 PM
The fog is finally starting to clear! Thanks.

jameswillmott
08-16-2006, 05:08 PM
I'm fairly sure that Dave has Minnaert and Oren-Nayar round the wrong way...

Oren-Nayar is the rough surface ( powdery ) shader and Minnaert is the one to use for velvet/fuzzy surfaces.

The moon is an example of Oren-Nayar with a very high roughness value, and thus all parts of the moon that are lit by the sun appear equally bright. Using Minnaert doesn't seem to produce this effect.

Other than that little nitpick thats a really informative post!

Dave Jerrard
08-16-2006, 06:01 PM
I'm fairly sure that Dave has Minnaert and Oren-Nayar round the wrong way...

Oren-Nayar is the rough surface ( powdery ) shader and Minnaert is the one to use for velvet/fuzzy surfaces.

The moon is an example of Oren-Nayar with a very high roughness value, and thus all parts of the moon that are lit by the sun appear equally bright. Using Minnaert doesn't seem to produce this effect.

Other than that little nitpick thats a really informative post!I think you got this one backwards. (about time too) :D


I've heard Oren-Nayar called a velvet shader since the 90's. Minnaert has been called the moon shader for a long time as well. According to this page (http://www.the123d.com/tutorial/general4/reflections2-1.shtml), Minnaert was "...initially developed to describe the BRDF for the moon, which has basically a lambertian reflection (which is pretty rare in nature) but also a small amount of back reflection." Of coruse, it's entirely possible this guy got it backwards too. 8/

Now this doesn't rule it out for velvet surfaces, and I think you're probably referring to the Minnaert-B mode here. Makes me wonder how many types of Minnaert there are.

Doing a search for Oren-Nayar and moon doesn't find a lot, but a search for the shader and velvet together finds quite a bit. It's entirely possible that Oren-Nayar was developed for simulating the moon as well, since there's variations of it as well. Both work well for either velvet or the moon though. There seems to be a bunch of velvet shaders out there that use variations of almost every shading model there is.

Thanks for the heads up though. It gave me a reason to dig a little deeper into these shaders. :)


He Who Thinks A Real Velvet Shader Is A Combination Of Several Others.

jameswillmott
08-16-2006, 06:30 PM
Thanks for the link, that's really informative...

This one describes Oren-Nayar and moons...

www1.cs.columbia.edu/CAVE/projects/oren/oren.php


And an excerpt from the original Siggraph paper...


As the roughness increases, the sphere begins to appear flatter. In
the extreme roughness case, as in the rightmost sphere, the sphere
appears like a flat disc with near constant brightness. This phenomenon
has been widely observed and reported in the case of the
full moon




I fully agree that OrenNayar simulates the roughness of velvet nicely, but I can't get that really nice velvety rim scattering effect with it that I can with Minnaert. I also find a lot of references to Minnaert and velvet shader with Google.

That's my reasoning for calling Minnaert a 'velvet' shader and Oren-Nayar a 'moon' shader.

Dave Jerrard
08-16-2006, 08:25 PM
This one describes Oren-Nayar and moons...

www1.cs.columbia.edu/CAVE/projects/oren/oren.phpThanks for the link.


I fully agree that OrenNayar simulates the roughness of velvet nicely, but I can't get that really nice velvety rim scattering effect with it that I can with Minnaert. I also find a lot of references to Minnaert and velvet shader with Google.

That's my reasoning for calling Minnaert a 'velvet' shader and Oren-Nayar a 'moon' shader.I'm getting the feeling that these two are frequently interchanged with velvet and moon shaders, so we're probably both right & both wrong. 8~

There seems to be a lot of different implementations of both shaders out there, so it's possible the Oren-Nayar one that we have in nodes isn't as well suited to velvet as other variants are. There does seem to be a bit of shading model chaos out there these days. I guess we have something to look forward to in the future - more shaders! :thumbsup:


He Who Foresees A Long List Of Shader Nodes In The Future.

norlight
08-17-2006, 03:15 AM
Im just now starting to understand how much fog is actually out there 8~

T-Light
08-17-2006, 09:05 AM
Cheers Dave :).

The more explanations on this stuff the better.
+ I now know how to render a velvet moon :D
Thanks again. :thumbsup:

Dave Jerrard
08-17-2006, 09:16 AM
I've edited the original post to include, or otherwise acknowledge, the additional info that Mr. Willmott has provided on the shaders. Thanks James!

There are a lot of variants available, both with original concepts and those borrowed from other models. If you think we have it bad with the sampling we have now, take a look at some of the shaders that have been developed:

http://www.renderman.org/RMR/Shaders/surface.html
http://www.3dexcellence.com/mayashaders.html
http://szaber.com/grafx/index.php?id=2&kid=4


He Who Still Has A Lot Of Stuff To Try Out.

trang
08-19-2006, 08:43 AM
Im just now starting to understand how much fog is actually out there 8~

..and i am wandering IN that fog...

Tesselator
08-19-2006, 09:18 AM
Viper is a great fog repellant!

Bog
08-19-2006, 10:08 AM
Thanks, Dave, that's saved me a bit of mucking about. Really must have a go with that thar ambient shader today.

I suggest we settle the "Moon Shader" question by rendering naked backsides and picking whichever looks better.

He Who Needs To Get Out More...

chikega
08-19-2006, 11:00 AM
Very nice Dave - Thanks! :)

Plakkie
08-19-2006, 01:47 PM
I was looking for this! Good to know some practical usages for all those cool shaders. Thanks a lot! :thumbsup:

mj418
08-20-2006, 03:25 PM
Thank you very much for all the info! :)

dx394b
04-01-2007, 08:59 AM
Ah! Eye've been looking for just such the thing. Your explainations have helped me a great deal Dave.

Most of the short time I've spent attempting to learn this artform has been in modelling. Only now have I begun to set foot in the texturing/lighting waters.
Thanks again, I feel a little less overwhelmed.

ercaxus
04-01-2007, 09:43 PM
Look at the 3rd paragraph:
http://ask.slashcode.com/comments.pl?sid=1084&op=&threshold=0&commentsort=0&mode=thread&tid=24&pid=3815

Mr Rid
10-02-2014, 07:20 AM
...Other good moon shaders include the Lommel-Seeliger and Hapke models.

Are these available for LW somewhere?

erikals
10-02-2014, 08:11 AM
nodes > http://democratsforprogress.com/forum/images/smilies/runforhills.gif

prometheus
10-02-2014, 08:26 AM
Nice guide there...Thanks a lot Dave.

Michael