Forum: Poser - OFFICIAL


Subject: Glossy materials with true Fresnel effect using matmatic

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


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

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.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)