# Welcome to the Poser Forum

Forum Moderators:  Kendra, KimberlyC, AmbientShade    Forum Coordinators:  Boni, fictionalbookshelf

Poser F.A.Q (Updated: 2015 May 22 11:51 am)

# Subject: Glossy materials with true Fresnel effect using matmatic

bagginsbill opened this issue on Sep 29, 2010 · 74 posts

bagginsbill ()  ( posted at 2:58PM Wed, 29 September 2010

A friend asked me in a private message about making a particular kind of paint shader. Since there's a lot to write, and I need a lot of pictures to demonstrate, I thought I'd give a little tutorial on using matmatic to produce a general purpose shader, focusing on the easy generation of an accurate Fresnel effect.

I will be building the shader bit by bit. You can follow along if you like. At the end, I will attach the finished script for you to use. I will call this the BBGlossy shader.

Please hold questions until the presentation is complete.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 2:58PM Wed, 29 September 2010 · edited on 2:58PM Wed, 29 September 2010

The Fresnel effect is that reflections are brighter when they strike a surface at a shallow angle. The devil is in the details. You can use an Edge_Blend node to modulate reflection value (amount of reflection) but while it may be directionally correct, it won't be accurate.

To get a completely accurate effect, you need quite a bit of math for the effect, and if you don't have Poser Pro, you need shader gamma correction. This is quite an ordeal to do by hand, but matmatic can take care of that for you pretty easily.

The main parameter of interest in this effect is called the Index of Refraction, or IOR. It may seem odd that refraction has something to say about reflection, but they go hand in hand. Even for opaque materials that do not pass light through, there is still an IOR involved that will determine how the reflections change with viewing angle.

The IOR of air is so close to 1 that we can safely assume it is one.

Reflection happens when light passes from one medium (usually air) to another medium in which the IOR is not 1, or vice versa. When the IOR of a material is 1, there is no reflection at all. When IOR is more or less than 1, there is reflection. How much and how it modulates depends on what the ratio of the material IOR is to air. Some materials have a thin coating that alters the effective IOR of the material. This is why a clear-coat finish on car paint makes it shiny - it has a higher IOR than the paint alone would.

Most materials have an IOR somewhere between 1 and 2. Water is IOR 1.33. Glass or glass-like materials are around 1.5.

So let's see how to do this with matmatic.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 2:59PM Wed, 29 September 2010

Here is a little scene I've set up for demonstrations.

I have an environment sphere with a city scene mounted in it. I have a dark ground, and a few boxes of various sizes and shades of gray surrounding my subject - a Poser sphere. The sphere has been scaled to 800%.

There is one infinite white light at 80%. I am using Poser Pro 2010 with IDL for global illumination (GI). If you don't have P8 or PPro2010, you'll need to use a second light - an IBL - to fake your GI.

In this initial render, the sphere has a simple white diffuse material, diffuse value = .8, no specular, no reflection.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 2:59PM Wed, 29 September 2010

Let's make a simple black glassy material. I won't deal with gamma correction yet, so if you don't have Poser Pro with render GC, you'll get very different results. We'll fix that in a bit.

So we want the true Fresnel calculation for IOR = 1.5.

This is easy. In matmatic, you say:

fresnel = TrueFresnel(1.5)

The fresnel variable is now a bunch of nodes that calculate the correct reflection coefficient for a 100% smooth material with an IOR of 1.5.

Now we need a reflect node. This is also easy:

reflect = Reflect()

Now we need to combine the fresnel effect with the reflect node. We could do this using the poser surface Reflection_Color and Reflection_Value channels. But this is a lot of typing, and also when we deal with shader GC, we can't use those anyway.

All we want is to use the fresnel coefficient as a coefficient - a multiplier. So we make our combination by simplying multiplying the two values.

combination = fresnel * reflect

And we want to make this our material output. Since this is so very common, matmatic has a very simply function, View, that takes one argument - what you want to see as the output of the shader. It builds an otherwise empty surface, and connects the argument to the Alternate_Diffuse channel.

surface = View(combination)

So let's put that all together - here is the entire script:

fresnel = TrueFresnel(1.5)
reflect = Reflect()
combination = fresnel * reflect
surface = View(combination)

For those that are amused by brevity, this can also be written as the one-liner:

View(TrueFresnel(1.5) * Reflect())

However, in steps that follow, we'd need to take that apart, so I'd stick with the four-line version.

The attached render shows the result.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:00PM Wed, 29 September 2010

Let's make this shader a little more flexible, and put a parameter node in it to control the IOR.

In matmatic, you use the PM function to make a parameter. Pass the initial value, and a label. It will make a math node for you and put it on the left side of the shader tree. All the non-parameter nodes will go on the right, and can be ignored when using the shader.

So this is a two line change. You want to say:

ior = PM(1.5, "IOR")
fresnel = TrueFresnel(ior)
reflect = Reflect()
combination = fresnel * reflect
surface = View(combination)

Once you make that, you can load it and then you can change the IOR on the fly without using matmatic any more.

This version, with an ior parameter, has a lot more nodes, but they are really cheap so don't worry about performance.

Attached is a render with ior = 1.2. Notice how the shallow angled edge reflections are still very bright, but the perpendicular reflections are weaker.

This is how IOR affects the reflection falloff. It doesn't change the shallowest reflections - they are still near 100%. It changes the perpendicular reflections the most.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:00PM Wed, 29 September 2010

What if you put a very high ior in? The perpendicular reflections will increase a lot, but they still won't be 100%. In fact, this is how metals behave.

With ior=30 - I get a chrome-like metal!

Metal IOR is actually more complicated than this, but for most purposes we can do a lot of metals using TrueFresnel with a high ior. Colored metals will take a little more work, though. We'll come back to this topic later.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:01PM Wed, 29 September 2010

If you're not using Poser Pro, we need to deal with gamma compensation.

The attached render shows what you get with ior=1.5 but no GC. It doesn't look right. The reflections are too dark.

As I've said many times, there are many ways to compensate for monitor gamma. Notice I didn't say correct for monitor gamma, but compensate. I don't want to have an argument about which technique you want to use to compensate. I'm just going to talk about gamma correction as *one* way to compensate, and demonstrate how easy it is with matmatic.

In matmatic, we have two functions to deal with gamma. They are

AGC - anti-gamma correct - used on color information coming into the shader.
GC - gamma correct - used on the final output of the shader.

In this shader, the Reflect node is bringing in color information from other parts of the scene. This is non-linear luminance info, since the other shaders are producing what they should when you look at them.

But we then multiply them with a linear fresnel reflection coefficient. This effectively screws up the luminance information. If we take half of a reflection, it doesn't look half as bright. It looks a lot darker than that.

So - we need to convert the incoming data from the reflect node to linear luminance information. We do that by saying:

reflect = AGC(Reflect())

This anti-gamma corrects the incoming data so it is linear.

Upon performing the calculation of the final pixel color we want, then we need to correct it for display.

output = GC(combination)
surface = View(output)

The whole script is now this:

ior = PM(1.5, "IOR")
fresnel = TrueFresnel(ior)
reflect = AGC(Reflect())
combination = fresnel * reflect
output = GC(combination)
surface = View(output)

Using this script, you'll get the same results I'm getting even if you don't have Poser Pro.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:01PM Wed, 29 September 2010

Now of course not every surface is black glass. We need a diffuse component.

When light strikes the surface, it has some chance or probability of being reflected. The fresnel value is giving us a number representing that probability. Of the remaining light that isn't reflected, the rest goes into the surface and is diffusely reflected in all directions. This sort of effect is computed by the Diffuse node as well as a few others. We'll start with Diffuse.

We'll want to make a color parameter so we can change the color easily in the shader, without going back to the matmatic script. You make color parameters using the PMC function. Let's pick a nice dark red to start - you can then change it in the material room.

color = PMC(Color(.3, 0, 0), "Color")

This data will be chosen by users (or you) on the basis of looking at it in the color chip. Well - that's how it *looks*. That isn't what the luminance data really should be. Remember, this is something your monitor is showing you, and it isn't linear.

In Poser Pro, all color chips are automatically anti-gamma corrected. But to make this work in all versions of Poser, we want to use the AGC function on it. So:

diffuseColor = AGC(color)

We will also want a parameter to control the diffuse reflection amount - usually called Diffuse Value.

diffuseValue = PM(.8, "Diffuse Value")

Then we want to make a Diffuse node out of those things:

diffuse = Diffuse(diffuseColor, diffuseValue)

Let's just see how that looks.

Putting this together in a new script, by itself, we use:

color = PMC(Color(.3, 0, 0), "Color")
diffuseColor = AGC(color)
diffuseValue = PM(.8, "Diffuse Value")
diffuse = Diffuse(diffuseColor, diffuseValue)
View(GC(diffuse))

It looks like the attached image.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:02PM Wed, 29 September 2010

Now we want to combine these with the Fresnel reflection shader.

Recall that if reflection is high, diffuse is low, and vice versa. In fact, they are in a "complementary" blended relationship. Whenever we want a complementary blended combination, we use a Blender node.

The blending factor here will be our fresnel value.

The whole script is:

color = PMC(Color(.3, 0, 0), "Color")
diffuseColor = AGC(color)
diffuseValue = PM(.8, "Diffuse Value")
diffuse = Diffuse(diffuseColor, diffuseValue)

ior = PM(1.5, "IOR")
fresnel = TrueFresnel(ior)
reflect = AGC(Reflect())

combination = Blend(diffuse, reflect, fresnel)
output = GC(combination)
surface = View(output)

The attached render shows the results. Fantastic!

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:02PM Wed, 29 September 2010 · edited on 3:13PM Wed, 29 September 2010

One little problem we have is that the Reflect node doesn't deal with lights. It only reacts to props and figures. We need to use a node that generates specular reflections of our directional light sources.

For 99% of materials, the best node to use is Blinn. It is very versatile. And it has the Fresnel effect built in, although not expressed in a way that is as easy to deal with as IOR.

Let's start simple. I'm going to add a Blinn node.

specular = Blinn(WHITE, .02, .5, 2)

And I want it on the left side of the shader tree so I can mess with it in the material room. The PM function will move it over there as if this node was a parameter.

specular = PM(specular)

Now I need to do one other thing. When the specular effect is strong, the diffuse effect should be weak. There is no perfect way to do this in Poser, but I have a hack that works pretty well. I treat the output of the specular node as if it was a number and use that to calculate the complementary amount of diffuse reflection.

diffuseValue = Sub(1, Clamp(specular))

Putting this all together, the script is:

specular = Blinn(WHITE, .02, .5, 2)
specular = PM(specular)
color = PMC(Color(.3, 0, 0), "Color")
diffuseColor = AGC(color)
diffuseValue = PM(.8, "Diffuse Value")
diffuseValue = diffuseValue * Sub(1, Clamp(specular))
diffuse = Diffuse(diffuseColor, diffuseValue)

ior = PM(1.5, "IOR")
fresnel = TrueFresnel(ior)
reflect = AGC(Reflect())

combination = Blend(diffuse, reflect, fresnel) + specular
output = GC(combination)
surface = View(output)

The attached image shows the results. Very convincing.

Experiment with different values of Eccentricity, SpecularRollOff, and Reflectivity.

Eccentricity is basically how big the highlight is. Lower values produce a smaller highlight.

The SpecularRollOff is the Blinn node's equivalent to IOR. Lower values will decrease the perpendicular reflection value.

And Reflectivity is the maximum reflectivity or shininess of the surface.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:03PM Wed, 29 September 2010

In this shader, we have now the Blinn Reflectivity to determine the maximum shine of the reflected lights. We have done nothing to deal with the maximum reflection from the Reflect node.

Let's add a parameter to specify the overall reflectivity and use it in both.

I'm going to set it's initial value to .5.

reflectivity = PM(.5, "Reflectivity")

I use it in the Blinn node:

specular = Blinn(WHITE, .02, .5, 2 * reflectivity)

And I'll use it to alter the output of the fresnel calculation:

fresnel = TrueFresnel(ior) * reflectivity

Putting it all together, the script is:

reflectivity = PM(.5, "Reflectivity")

specular = Blinn(WHITE, .02, .5, 2 * reflectivity)
specular = PM(specular)
color = PMC(Color(.3, 0, 0), "Color")
diffuseColor = AGC(color)
diffuseValue = PM(.8, "Diffuse Value")
diffuseValue = diffuseValue * Sub(1, Clamp(specular))
diffuse = Diffuse(diffuseColor, diffuseValue)

ior = PM(1.5, "IOR")
fresnel = TrueFresnel(ior) * reflectivity
reflect = AGC(Reflect())

combination = Blend(diffuse, reflect, fresnel) + specular
output = GC(combination)
surface = View(output)

The render is attached.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:03PM Wed, 29 September 2010

Earlier we found that a high IOR gave us a chrome-like metallic appearance.

Let's accentuate that, and deal with other colors.

In addition to a high IOR, a colored metal produces specular reflections that are colored as well. (Again, the truth is more complicated than I'm going to deal with. What I'll show you is good enough.)

I'm going to rearrange things a bit, and then calculate a "metallic" factor. I'm going to make a simple assumption - anything with IOR below 3 is not at all metallic. Starting at 3, the "metallic" factor will increase to a maximum of 1 when the ior is 23. Why 23?

metallic = Clamp(.05 * (ior - 3))

The reason for 23 is because I wanted to type .05 there. The value increases after ior is above 3. The maximum is reached when:

.05 * (ior - 3) = 1

which means when:

ior = 23

Now I'll need to decide on a blended specular color. For non-metals (also known as dialectrics) we still want white. For metals, we want to use the same as the diffuse color.

specularColor = Blend(WHITE, diffuseColor, metallic)

We also want to severely drop the diffuse value for metals.

diffuseValue = diffuseValue * (1 - .98 * metallic)

We also should be boosting the specular falloff value when ior is higher:

specular = Blinn(specularColor, .02, .4 + .5 * metallic, 2 * reflectivity)

The full script is now:

color = PMC(Color(.3, 0, 0), "Color")
diffuseValue = PM(.8, "Diffuse Value")
ior = PM(1.5, "IOR")
reflectivity = PM(.5, "Reflectivity")

diffuseColor = AGC(color)
metallic = Clamp(.05 * (ior - 3))
specularColor = Blend(WHITE, diffuseColor, metallic)

specular = Blinn(specularColor, .02, .4 + .5 * metallic, 2 * reflectivity)
specular = PM(specular)
diffuseValue = diffuseValue * Sub(1, Clamp(specular))
diffuseValue = diffuseValue * (1 - .98 * metallic)
diffuse = Diffuse(diffuseColor, diffuseValue)

fresnel = TrueFresnel(ior) * reflectivity
reflect = AGC(Reflect()) * specularColor

combination = Blend(diffuse, reflect, fresnel) + specular
output = GC(combination)
surface = View(output)

Using this script as is, there is no change from the previous render.

But if you adjust the parameters as follows:

Color=RGB 255, 220, 50
Diffuse Value=.8
IOR=30
Reflectivity=.8

Then you get a credible gold metal. See attached image.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:04PM Wed, 29 September 2010

The last thing to deal with is soft, blurry reflections.

Note: Unless you have a powerful computer, you may want to stay away from trying blurred reflections.

You can only go so far with this before you get artifacts in Poser. But still it can be used to good effect, particularly in architectural metals.

We want to add a parameter to deal with blur:

blur = PM(0, "Blur")

I set it to 0 initially, but when you want, you change it in the material room.

We want to use this to increase the eccentricity:

eccentricity = .02 + .2 * blur
specular = Blinn(specularColor, eccentricity, .4 + .5 * metallic, 2 * reflectivity)

Also, we need to make the Blinn node less reflective when it is blurry. I'll use an exponential function: .25 ** blur. When blur is 0, this is 1. When blur is 1, this is .25. In between it will interpolate quadratically.

specReflectivity = 2 * reflectivity * (.25 ** blur)
specular = Blinn(specularColor, eccentricity, .4 + .5 * metallic, specReflectivity)

And we'll need to increase the reflect node softness and quality to go with the blur.

quality = .2 + Clamp(5 * blur)
reflect = AGC(Reflect(BLACK, blur, quality)) * specularColor

Putting it all together, the script is:

color = PMC(Color(.3, 0, 0), "Color")
diffuseValue = PM(.8, "Diffuse Value")
ior = PM(1.5, "IOR")
reflectivity = PM(.5, "Reflectivity")
blur = PM(0, "Blur")
quality = .2 + Clamp(5 * blur)

diffuseColor = AGC(color)
metallic = Clamp(.05 * (ior - 3))
specularColor = Blend(WHITE, diffuseColor, metallic)

eccentricity = .02 + .2 * blur
specReflectivity = 2 * reflectivity * (.25 ** blur)
specular = Blinn(specularColor, eccentricity, .4 + .5 * metallic, specReflectivity)
specular = PM(specular)
diffuseValue = diffuseValue * Sub(1, Clamp(specular))
diffuseValue = diffuseValue * (1 - .98 * metallic)
diffuse = Diffuse(diffuseColor, diffuseValue)

fresnel = TrueFresnel(ior) * reflectivity
reflect = AGC(Reflect(BLACK, quality, blur)) * specularColor

combination = Blend(diffuse, reflect, fresnel) + specular
output = GC(combination)
surface = View(output)

With blur=1, see the attached render.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:04PM Wed, 29 September 2010

Let's see how it does at simulating a blurry copper:

Color = RGB 255, 128, 64
Diffuse Value = .8
IOR=30
Reflectivity=.8
Blur=.5

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:05PM Wed, 29 September 2010

You can think of all these parameter nodes as a new kind of Poser surface. You can load it and then add additional nodes plugged into the parameters. For example, you can plug a color map in the Color node. You can plug a reflectivity map or a node that makes a pattern into the IOR or all sorts of things.

This completes the presentation.

You now have an easy way to make 56 nodes of shader goodness.

The script is attached.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 3:32PM Wed, 29 September 2010

For those that don't want to deal with matmatic, attached is the actual Poser material file. Remove the .txt extension when you save it.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bopperthijs ()  ( posted at 5:41PM Wed, 29 September 2010

Very Impressive! :smile:
I should really invest more time in learning  Matmatic.

best regards,

Bopper.

-How can you improve things when you don't make mistakes?

Anthanasius ()  ( posted at 7:12PM Wed, 29 September 2010

Interesting ! The only black point is the render time with blur reflexion ...

Génération mobiles Le Forum / Le Site

Latexluv ()  ( posted at 9:13PM Wed, 29 September 2010

Fantastic! Bookmarking!

"A lonely climber walks a tightrope to where dreams are born and never die!" - Billy Thorpe, song: Edge of Madness, album: East of Eden's Gate

Weapons of choice:

Poser Pro 2012, SR2, Paintshop Pro 8

whipporwill ()  ( posted at 9:31PM Wed, 29 September 2010

thanks for the tutorial and mat!

Winterclaw ()  ( posted at 11:02PM Wed, 29 September 2010

Dumb question, bill, you said this:

Quote - The Fresnel effect is that reflections are brighter when they strike a surface at a shallow angle.

Is the opposite of this ever true in real life?  That refections get dimmer at higher angles?

Nice tutorial BTW.  Reminds me I should try out matmatic.

WARK!

Thus Spoketh Winterclaw: the brilliantest blog ever written by me

(PP12 SR3, on 64 bit Win 7, poser units are inches.)

infinity10 ()  ( posted at 2:02AM Thu, 30 September 2010

wow - must digest the discussion slowly...  Thanks for sharing !

Eternal Hobbyist

RobynsVeil ()  ( posted at 6:53AM Thu, 30 September 2010

Those in-built functions like PM() and TrueFresnel() and View() are all Matmatic 1.1, aren't they? Blown away by what you're hinting at using these functions. I would guess there's a fair-few more?

This is incredible, BB... thank you again for the detailed explanation but even more for the gift of True Fresnel for Poser.

Mint 17LTS/Win7Pro - Blender 2.74 - PoserPro 2014(in)/Matmatic - GIMP - Lightworks12
Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[we realise that people hold in contempt that which they do not understand]

bagginsbill ()  ( posted at 7:34AM Thu, 30 September 2010

Yes they are matmatic 1.1.

There really isn't much else for new functions in 1.1. I added the loom as part of the package. And I added the Parameters class, which I actually developed with you on one of your projects, RV.

The Parameters class makes an object that holds parameters and you can use it to make new ones. It's handy.

I didn't use it in this shader, but it would be easy enough to demonstrate how you would if you like.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 7:36AM Thu, 30 September 2010

Quote - Dumb question, bill, you said this:

Quote - The Fresnel effect is that reflections are brighter when they strike a surface at a shallow angle.

Is the opposite of this ever true in real life?  That refections get dimmer at higher angles?

Nice tutorial BTW.  Reminds me I should try out matmatic.

That's not a dumb question at all. You'd think that it could be possible, perhaps if the IOR is less than 1. But that's not the case at all. Reflections are always strongest when they are the most shallow angle.

However, there is more to the Fresnel curve than that. Want to see graphs?

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 7:52AM Thu, 30 September 2010

http://en.wikipedia.org/wiki/Fresnel_equations

The article mentions several interesting things that I conveniently ignore here:

A) Polarized light behaves differently depending on the angle of polarization.

Poser has no way to represent light polarization so we can't use this info. I used the unpolarized calculation. Polarized light is not a common real-life occurance, except light which has reflected off of water. This is why polarized sun-glasses work to reduce glare when on a boat. We'd only care if we were dealing with secondary and tertiary reflections in a water scene *and* we were specifically setting out to demonstrate a side-by-side difference. By itself, you would never notice that polarization was being ignored in a way that causes an obvious departure from reality.

B) In metals and semiconductors, the IOR is not a simple "real" number. It is a complex number (it has a non-zero imaginary component).

I'd love to see how this actually is done. I have not found any reference that clearly explains the details, and I suspect my math skills might be insufficient to exploit the info even if I had it. The article's mention of this is tantalizing, though.

C) For accurate modeling of thin films, you must also take into account the frequency of the light.

This is an important effect. The rainbow reflections from oily puddles (such as in a parking lot) are produced by this. I have faked this in the past. I think LuxRender can handle this kind of thing. I suppose I could make Poser do it with some improvement in accuracy over the hack, but why bother? It's not a common feature in your typical Poser render.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

scanmead ()  ( posted at 8:24AM Thu, 30 September 2010

This should be required reading for anyone making shaders in any platform. Bookmarking also.

bagginsbill, you speak light better than anyone else I know. ;)

Winterclaw ()  ( posted at 11:02AM Thu, 30 September 2010

So fresnel only works the one way?  That's interesting to know.

WARK!

Thus Spoketh Winterclaw: the brilliantest blog ever written by me

(PP12 SR3, on 64 bit Win 7, poser units are inches.)

bagginsbill ()  ( posted at 11:16AM Thu, 30 September 2010

By one way, if you mean that shallow reflections are always strongest, then yes.

If by one way, you meant external reflections versus internal, then no - it works both ways.

For internal reflections, such as from inside glass or water, the ratio of the IOR is less than 1. In such cases, there is the phenomenon of total internal reflection (TIR).

My TrueFresnel function will implement TIR if you give it an IOR less than 1.

There is an unfortunate limitation in Poser that a shader can't tell (at least not easily and universally) if it is shading the outside or the inside of a surface. This means it is difficult to make a single fresnel shader that works correctly for things such as diamond. In a diamond, the TIR effect is very important - in fact the angles of the facets are chosen specifically to exploit TIR.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 11:19AM Thu, 30 September 2010

I went looking in free stuff for some jewelry that would be a good candidate for using this shader.

I found this:

http://www.renderosity.com/mod/freestuff/details.php?item_id=61750

Here is how that renders with the shaders provided. The shaders do not use real reflection, so do not react to the objects and lights in the scene. They use environment maps, which are OK but not my preference.

Click for full size.

 I use Poser Pro 2014 on Win 7, Win 8, and Mac OSX. My Poser Display Units are inches.

bagginsbill ()  ( posted at 11:20AM Thu, 30 September 2010