Double Sided Fresnel!


(HISEROD) #1

Hi! everyone, I finally fixed it! Just look below!:eek:





(HISEROD) #2

Examples:







(pixelgrip) #3

Hi,can you explain what are you done,why we need a fix and for what situations and the math behind it? its the first time i saw fix for the fresnel like this.i mean if i drop a fresnel fac to a mainly used standart method like ,diffuse and glossy mix shader,i get a result like your fixed examples right out of the box.i am overlooked something here?


(HISEROD) #4

Hi, pixelgrip, the whole purpose of this is to make the Fresnel node work on both sides of a surface. The moebius strip is a perfect example of why this is important; because it is one sided, certain parts will look like my “OLD” examples because of the inverted normals or direction the surface is facing. To fix it I first realized that when you look at the back of the faces and adjust the IOR to a value below one it works like a layer weight on the inside, but the problem has travelled to the outside, therefore I concocted the node setup shown above. But a lot of people still prefer to set an exact IOR, so I tinkered around with math nodes until I came up with a good IOR converter.

btw it’s hard to fully explain all the math.


(system) #5

Here another version by Greg Zaal. I think that was years ago he made it:

[ATTACH=CONFIG]485687[/ATTACH]

And the way you use it is like this:
[ATTACH=CONFIG]485696[/ATTACH]

It’s simple, it is flipping the IOR at the backface.


(Secrop) #6

The math is not that hard to explain…

The thing is that Cycles deliberately inverts the IOR when the incoming ray is hitting the backside. This is the normal behaviour if the object is volumetrically closed.

In physical terms, the IOR value is the relation of the speed of light from one medium to the other. A medium with an IOR of 1.5 means that after entering the medium light will be 1.5 slower. If the exiting medium is the same as the initial medium, the IOR of the backside should be 1/1.5 = 0.666.

However sometime we don’t want this invertion to happen (in case of the second medium is something else, or our object is thinwalled or not closed, etc). In these situations we have to force the inverted IOR when the ‘is_backside’ flag is true.


(HISEROD) #7

Okay then, I didn’t realize this had been done before. Thanks for sharing the info guys.


(pixelgrip) #8

Thanks for explanation to all.