Cycles-nodes implementation of a better glossy shader

Hi guys, did you catch this?



In short it says that common glossy shader models are wrong. In every unbiased renderer!
That cleared my doubts about glossy shader in Cycles. Did you ever notice the strange behaviour with high (over than .5 or .6) roughness values?

A step back.
Being interested in PBR lately (since i found CynicatPro excellent tutorials on YT), i was asking myself ‘what is glossy and what is diffuse in nature?’ my answer was “There’s no difference, diffuse is just like glossy but with a high roughness value”.
The problem is that in CG we don’t have a unified shader that covers these two conditions. Therefore we have two mathematical models, that together cover the whole range of roughness. But again, diffuse is like glossy with high roughness. Or at least it should be.

With this idea in mind I tried to experiment and this is what I have so far:

http://i.imgur.com/4OXKyvR.gif

On the left unchanged glossy shader behaviour, on the right fixed glossy. Notice how at the end (high roghness) the original shader tends to get dark and in general doesn’t look like diffuse

I’d like to hear your thoughts on this…

And here is the easy node setup:

interesting

or may be have a new node combine gloss+diff sort of like PBR

I thought we are supposed to get a new PBR nodes soon !

happy cl

Could you achieve a similar effect by adding two glossy shaders together. Your primary shader would deal with the colour etc - and the second shader would deal with the energy loss.

The second shader would start off black for roughness 0.0 and you would then increase it’s colour as the roughness increases to add in the bit of light that is lost due to the single scattering model.

What is the reason for mixing by power of 5?

it changes the curve shape form linear to exponential!

happy cl

@moony
the point is that at roughness=1 here i wanted the shader to be(have) diffuse. Adding two glossy won’t work.

@Lumpengnom
as Ricky said. Power of five is also roughly the exponential for fresnel approximation (Schlick). It’s eyeballed, but i liked to reuse this exponential which is already used in another optic physics model

A nice one: diffuse between 0.9 and 1.0 look like roughness (1 to 0) in diffuse shader.

All in all this little test nodegroup looks like a unified surface shader. Since it’s based on diffuse it can’t work for glass and refraction shaders which have the same roughness issue

by the way how would you add some other texture proc or image without loosing the effect !
just add other mix with new FAC input ?

thanks
happy cl

I thought that at roughness = 1 the glossy was effectively the same as a diffuse.

All the second glossy would do is to add in the energy loss.

as far as i have learned it should

It’s a matter of trying it. You’ll see that you’re just adding two wrong behaviours :wink:

@Isscpp
How would you incorporate Fresnel into this? In particular the accurate Fresnel from CynicatPro?\

EDIT: I just replaced the glossy shader in my physically based shader which uses the accurate fresnel node, and it appears to work fine, max roughness in metallic mode and diffuse look nearly identical, but there are no fresnel reflections this way as opposed to normal diffuse in the shader.

@Isscpp
this is a very good information!!! :smiley:
I had suspections that this behaviour was happening, but never went deep into the analysis.
hope to have time this weekend to go a bit deep into the papers.

Tnx :slight_smile:

I’m experimenting too. In theory we can just replace every shader (glossy and diffuse) with this group, once it is well balanced

So did you reprogramm the glossy node to act like described in the paper or is this the standard Cycles glossy node?

it’s a nodegroup as shown in the screenshots.
As Kram1032 answers in his post at blendernation, it’s still noticeable a brightening at the end of animation, and at 50-80% you can guess an energy loss. Well, still working on this…

I know that thread, but the matter here is roughness, not index of refraction. As to say How, not How much

WRT glass/refraction, we do have a “diffuse” transmission, that is, Translucent BSDF :wink:

indeed, later i’ll experiment with that too

Bumping this (waiting for Lukas goodness)…

Reflective unified BSDF: http://www.pasteall.org/pic/show.php?id=103318
Refractive unified BSDF: http://www.pasteall.org/pic/show.php?id=103319

I tried to keep the easiest possible node setups while actually getting the preserving energy look.
Have a try