PDA

View Full Version : Oren-Nayer, Cook-Torrance and friends...



ingo
01-07-2010, 08:52 AM
Hi, can somebody enlighten me when to use those diffuse and specular nodes. I looked in the manual (really !!) but that doesn't really give me much insight. So any tips, or websites, explaining this are welcome.

MrWyatt
01-07-2010, 09:19 AM
http://en.wikipedia.org/wiki/Oren%E2%80%93Nayar_Reflectance_Model

ingo
01-08-2010, 03:46 AM
Thanks, but not really more information than i already have.

Matt
01-08-2010, 04:00 AM
I don't think there are any rules as to when to use them, they are just different diffuse algorithms that have different looks, so it's totally up to you which suits what you're doing.

At least, that's what I've always thought.

RebelHill
01-08-2010, 04:43 AM
Its pretty straight forward... even from the manual...

OrenNayar is a diffuse shading model... improvement to the Lambertian model and especially good for simulating rough surfaces like clay where the darker areas tend to reflect light causing the surface to appear rougher...

K. E. Torrance and Sparrow designed a physical based BRDF in 1967, that produced a rough surface as a base.... The Cook-Torrance model is a very common BRDF good for simulating a wide variety of materials from metal to some types of cloth.

If it can be explained in any more straight forward terms... Im at a loss to think what they could be.

ingo
01-08-2010, 08:16 AM
Well rough and wide variety are a bit rough explanations, most materials are a bit rough. And i still have no clue about the roughness setting, what is 100% roughness ?
When i use Oren-Nayer my materials look more realistic in the shadows, not that dark like without it.

oobievision
01-08-2010, 08:24 AM
well u would use Oran-Nayer on an object that has a bump map and isnt transparent. to highlight its roughness. where u would use dialectric, fast or real Fresnel on glass water and other materials that have a transparency. though experimenting with these to achieve diff results always works. its really the end result, if ur happy with it then wich is the right one to use. the results u like or something diff.

Tobian
01-08-2010, 12:48 PM
As a note: none of the diffuse shading models works with radiosity, and that's not in the manual :D So it's pretty much pointless using them.

The only way to get the 'look' of a non-lambertian-rough diffuse shading model is to apply a microbump, much as you do for reflection, and it does make surfaces look attractive, at the cost of render time, to bake out the noise...

RebelHill
01-08-2010, 01:00 PM
As a note: none of the diffuse shading models works with radiosity

Umm... yes they do... have used them with such many times myself.

Tobian
01-08-2010, 01:13 PM
I mean specifically the parts of the model which are not lit by directional light, not that radiosity disables the shader. I've read that several times on this forum...

I will investigate though :)

serge
01-08-2010, 01:55 PM
Ingo, have you seen this excellent post by Dave Jerrard? It might be helpful (he doesn't go into details about specific parameters though):

http://www.newtek.com/forums/showthread.php?p=425700


(BTW, Dave if you read this, are you still with us? Haven't seen you posting for quite a while. Are you following CORE development?)

Tobian
01-08-2010, 01:56 PM
Ok
Image 1 - the ball lit with a single large area light...
Image 2 - the ball lit with only the luminous plane (use bumps enabled)
Image 3 - the ball lit with only the luminous plane + with microbumps...

As you can see the Oren Nayer shader does nothing if there's no light in the scene, which might be aplicable for any 'interior' scene, with a mostly occluded sun-light and only bounce light filling the room. (where you might want roughened walls for old plaster?)

With the addition of a microbump to the shader, it creates the same 'effect' of the oren nayer diffuse shader (as it basically is that :D Oren nayer simulates microscopic turbulence)

As a note: I rendered these in linear colour space, which gives a much more pleasing falloff :)

IRML
01-08-2010, 03:20 PM
Umm... yes they do... have used them with such many times myself.under radiosity lighting oren nayer will just render like a standard lambert, so it might look like it's working, but it's not doing what it's supposed to be doing

I'm not sure if it does that in every 3D app, or just newtek's implementation does, but seeing as they messed up the cook torrence shader I'm guessing it's another screw up

Cageman
01-08-2010, 05:04 PM
under radiosity lighting oren nayer will just render like a standard lambert, so it might look like it's working, but it's not doing what it's supposed to be doing

I'm not sure if it does that in every 3D app, or just newtek's implementation does, but seeing as they messed up the cook torrence shader I'm guessing it's another screw up

I hope you have filled out a bug-report with testcontent so the devs can fix this bug then?

Tobian
01-08-2010, 05:10 PM
I'd be surprised if Newtek don't know about the Oren Nayer/ Cook Torrence bugs by now, they've been known about for some time. Gerardo even has a 'fix' for the Cook-torrence bug, but it's not perfect!

IRML
01-08-2010, 06:30 PM
I hope you have filled out a bug-report with testcontent so the devs can fix this bug then?from what I understand it's been reported many times over the years, but nothing came of it, so I'm not wasting my time

Intuition
01-08-2010, 06:59 PM
Are you guys referring to the spec shading of shaders in radiosity?

If so you will never get them to work with radiosity unless said radiosity is lit with an actual virtual light as a source.

The spec effects need actual virtual lights to have somthing to base the directional shading with.

If you are lighting with a reflector card or luminous polygon (lumigon) with radiosity on you will only get the diffuse because a reflector card or HDRi for that matter are only casting reflection and radiosity rays (diffuse) and can not talk to the spec channel shading of any shader. Only a virtual light (directional, spot, area, point) can cast information that these spec specific shaders can see.

The physically accurate shaders in Vray or Mental Ray can receive spec information for the sake of the amount / spread of reflection blur (Blinn, Phong, Ward) which is why they are included but the real effect happens so because the reflection blur IS the specular you would get in real life.

These shaders you are referring to are creating a highlight spread that is not reflection based (physically accurate) but rather an effect which is less costly in rendertime then raw raytracing but can give a similar look if used properly. Yet these shaders need virtual lights to give them the "spec" hit. GI from cards or HDRi does not talk to these shaders' spec channel.

There is nothing to "bug" in this case.

Cageman
01-08-2010, 07:59 PM
There is nothing to "bug" in this case.

I snipped the rest, since the explanation makes perfect sense to me. Thanks alot!

:)

IRML
01-08-2010, 09:26 PM
Are you guys referring to the spec shading of shaders in radiosity?

If so you will never get them to work with radiosity unless said radiosity is lit with an actual virtual light as a source.

The spec effects need actual virtual lights to have somthing to base the directional shading with.

If you are lighting with a reflector card or luminous polygon (lumigon) with radiosity on you will only get the diffuse because a reflector card or HDRi for that matter are only casting reflection and radiosity rays (diffuse) and can not talk to the spec channel shading of any shader. Only a virtual light (directional, spot, area, point) can cast information that these spec specific shaders can see.

The physically accurate shaders in Vray or Mental Ray can receive spec information for the sake of the amount / spread of reflection blur (Blinn, Phong, Ward) which is why they are included but the real effect happens so because the reflection blur IS the specular you would get in real life.

These shaders you are referring to are creating a highlight spread that is not reflection based (physically accurate) but rather an effect which is less costly in rendertime then raw raytracing but can give a similar look if used properly. Yet these shaders need virtual lights to give them the "spec" hit. GI from cards or HDRi does not talk to these shaders' spec channel.

There is nothing to "bug" in this case.if this was addressed at me, then: I'm not stupid

in fact I didn't see anyone make any mention of not getting spec with radiosity, problems with oren nayer and cook torrance are unrelated

Intuition
01-09-2010, 03:04 AM
I snipped the rest, since the explanation makes perfect sense to me. Thanks alot!

:)

No probs Cageman ;D

Intuition
01-09-2010, 03:10 AM
if this was addressed at me, then: I'm not stupid

in fact I didn't see anyone make any mention of not getting spec with radiosity, problems with oren nayer and cook torrance are unrelated

What? Huh? ;D How'd you get involved in this mess?

Boy I'll tell you one thing though, I must be stupid. :D

For some reason I interpreted Tobian and others as trying to get to the bottom of the shader only acting diffuse under GI lighting. Guess I assume too much. :hat: I figured I'd put on my trying to be a smarty pants hat but it fell off again. ;)

Tobian
01-09-2010, 04:42 AM
Uhm, you interpreted wrong! :D IRML mentioned the Cook Torrence shader *also* being broken, but yeah that has nothing to do with radiosity, and is a separate issue. I only mentioned using Oren Nayer shading, and if you look at the pics, it's apparent I didn't use any spec there.

Cook Torrence is broken because it's clipped at '1', It's possible to work around that by using a spot node and messing on with the surface normal, but it's hardly ideal for the noob! :) It's doubly annoying because it also affects the 'materials' which all seem to use a form of Cook Torrence specular instead of the standard LW Blinn specular which for the most part works perfectly.

Captain Obvious
01-09-2010, 05:27 AM
I ended up building a custom node network for CT speculars a while ago. It took, oh, about 50 nodes or so. Worked fine, though.

Tobian
01-09-2010, 05:30 AM
That sounds... convenient :D

ingo
01-09-2010, 06:52 AM
Now that is funny, i thought i ask a basic question (..and thought i am stupid..) but whats the result : Half of it is not working and half of it works not as expected (with a simple 50 nodes workaround), but the rest works fine.

What i missed in the manual is a simple example showing the result of the shader, like they did it with other shaders. Now i know why they haven't done it. So far thanks for the explanations, still need more node testing here to get a nice texturing.

Btw, Dave J's explanations is fine (and long as always) too, wonder what happend to him, maybe he is pregnant ?:p

RebelHill
01-09-2010, 07:00 AM
under radiosity lighting oren nayer will just render like a standard lambert, so it might look like it's working, but it's not doing what it's supposed to be doing

Well, well, How about that, id never noticed that... I stand corrected... nice show tobian too.

Hitler will not be pleased ;)

Captain Obvious
01-09-2010, 07:21 AM
That sounds... convenient :D
It was really quite useful. I was building a set of shaders that produced a shiny look, but were *completely* view-angle independent. The CT shader let me use two reference items (or vector constants) for the 'light' position and 'camera' position, and produced a specular highlight accordingly. When you then move the render camera around, the highlight stays in the same place. This means that the *baking* camera worked fine, too.

Tweaking the exact look of the highlight could then be done by texturing, tweaking the roughness, or moving light and/or camera around. All on a per-highlight basis. The amount of control was simply staggering. Basically, manually painting your model with light and shading! :D Not a fast process by any means, but it looked pretty awesome when baked.

There was also a soft reflection shader that baked properly. The whole thing was really cool. Probably the most fun thing I've ever worked on! :D Heh, I should learn C and become a shader programmer instead.

ingo
01-09-2010, 10:14 AM
Can't you get the results of the nodes with gradients, for example light incidence ?

Tobian
01-09-2010, 10:44 AM
Yes and no. Some of what you are doing with nodes you can do with gradients, but a lot of it you can't. That and you'd be really pushing the capability of the layer system to scratch the surface of even a simple nodal shader set-up.

Captain Obvious
01-09-2010, 11:15 AM
Not to mention the fact that anything even moderately complicated is significantly easier to do with nodes. This one surface I was building was made up of, I think, about 300 layers in total. In converting it to a node-based surface, it was instead made up of around 30 nodes, and most of them controlled collectively.

Kuzey
01-09-2010, 12:26 PM
Not to mention the fact that anything even moderately complicated is significantly easier to do with nodes. This one surface I was building was made up of, I think, about 300 layers in total. In converting it to a node-based surface, it was instead made up of around 30 nodes, and most of them controlled collectively.

Do you have a render of how this surface looks like...it sounds all too interesting. But I guess it's attached to a silly NDA thingy.

:hey:

Kuzey

Captain Obvious
01-09-2010, 02:55 PM
But I guess it's attached to a silly NDA thingy.
Oh, totally.

ingo
01-10-2010, 04:32 AM
Not to mention the fact that anything even moderately complicated is significantly easier to do with nodes. This one surface I was building was made up of, I think, about 300 layers in total. In converting it to a node-based surface, it was instead made up of around 30 nodes, and most of them controlled collectively.

Have you ever heard of keep it small and simple :rolleyes:

Captain Obvious
01-10-2010, 08:05 PM
Have you ever heard of keep it small and simple :rolleyes:
I didn't build the layer-based surface, I just converted it into nodes to make it easier to control. :)