Sun, Nov 10, 12:49 AM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 09 11:21 pm)



Subject: Glossy materials with true Fresnel effect using matmatic


  • 1
  • 2
bagginsbill ( ) posted Wed, 29 September 2010 at 2:58 PM · edited Sun, 10 November 2024 at 12:40 AM

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.
 


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)


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

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. 


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)


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

file_459796.jpg

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.
 


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)


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

file_459797.jpg

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.


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)


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

file_459798.jpg

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.


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)


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

file_459799.jpg

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.


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)


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

file_459800.jpg

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.


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)


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

file_459801.jpg

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.


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)


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

file_459802.jpg

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!


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)


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

file_459803.jpg

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.


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)


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

file_459804.jpg

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.
 


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)


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

file_459805.jpg

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)


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

file_459806.jpg

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.


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)


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

file_459807.jpg

The shader is now complete.

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

See attached. Not bad.


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)


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

file_459808.txt

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.

 


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)


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

file_459809.txt

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.


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)


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

Very Impressive! 😄
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 Wed, 29 September 2010 at 7:12 PM

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

Génération mobiles Le Forum / Le Site

 


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

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 Wed, 29 September 2010 at 9:31 PM

thanks for the tutorial and mat!





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

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: a blog about a Winterclaw who speaks from time to time.

 

(using Poser Pro 2014 SR3, on 64 bit Win 7, poser units are inches.)


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

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

Eternal Hobbyist

 


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

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.

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


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

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.


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)


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

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?


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)


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

I made the TrueFresnel function based on information from this article:

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.


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)


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

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 Thu, 30 September 2010 at 11:02 AM

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

Thanks for the link BTW. 

WARK!

Thus Spoketh Winterclaw: a blog about a Winterclaw who speaks from time to time.

 

(using Poser Pro 2014 SR3, on 64 bit Win 7, poser units are inches.)


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

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.


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)


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

file_459832.jpg

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.


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)


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

file_459833.jpg

Here using the BBGloss shader.

The beads used a 3-node procedural to generate the color. I copied those and pasted them into the BBGloss shader, and connected them to the Color parameter.


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)


Latexluv ( ) posted Thu, 30 September 2010 at 5:43 PM

file_459844.jpg

Since I couldn't figure out how to get the chrome/silver from one of the demo pictures......TA-DA -- Metallic Glass!

"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

 

 


bagginsbill ( ) posted Thu, 30 September 2010 at 10:50 PM · edited Thu, 30 September 2010 at 10:57 PM

For chrome or silver set the Color=white, IOR=30, blur=0. Adjust Reflectivity as you see fit, but around .8 to .9 is usually right for chrome.


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)


bagginsbill ( ) posted Thu, 30 September 2010 at 10:53 PM

file_459853.png

Here's how I did the aluminum-like metal in the Dalek image I posted:

http://www.renderosity.com/mod/gallery/index.php?image_id=2116138


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)


bagginsbill ( ) posted Thu, 30 September 2010 at 10:54 PM

file_459854.png

Here's the brass.


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)


bagginsbill ( ) posted Thu, 30 September 2010 at 10:55 PM

file_459855.png

The blue parts.


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)


SamTherapy ( ) posted Thu, 30 September 2010 at 11:09 PM

Very cool work, BB.  I don't think I have Matmatic yet so I'll grab it and do some reading up. 

Coppula eam se non posit acceptera jocularum.

My Store

My Gallery


mackis3D ( ) posted Fri, 01 October 2010 at 12:34 AM

BB tanks for the matmatic shaders and the explainations. I still understand it only if I see the parameters in the images to try it myself. But if I've done it a few times myself it's as easy as the VSS is. Thanks a lot!


vincebagna ( ) posted Fri, 01 October 2010 at 7:02 AM

Thank you BB!

It answers some of my questions about your shaders.
And i think i managed to make a simple general shader with an image map and a bump map nodes, some Blinn and autoGC by looking at your shaders and trying to understand what do what :)

My Store



Larry F ( ) posted Fri, 01 October 2010 at 7:30 AM

Goodness!


vincebagna ( ) posted Fri, 01 October 2010 at 12:56 PM

file_459881.jpg

With some changes the BBGlossy can give some wet effect to skin too :)

My Store



Latexluv ( ) posted Fri, 01 October 2010 at 4:41 PM

Cool, vincebagna, wouldn't mind having that skin shader in my runtime!

"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

 

 


Anthanasius ( ) posted Fri, 01 October 2010 at 5:35 PM

@Vincebagna, i've tried this, but even with a really low render setting, it take a very looooooooooooooooooooooooooooooooooong time to finish the picture .

Firefly isn't done for this at this time.

Génération mobiles Le Forum / Le Site

 


bagginsbill ( ) posted Sat, 02 October 2010 at 7:38 AM

Vince - very nice image.

Anthanasius - You are right. As I said, you must have a powerful computer or it just takes too long. I never explored these types of materials until recently, after I got my 8-core desktop. Now this type of render is 45 minutes, which I can tolerate.


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)


Sentinelle ( ) posted Sat, 02 October 2010 at 9:47 AM

Quote - 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 see I've been missing a lot lately.  This is the busiest time of the year at work and I haven't been able to log into Renderosity often enough.  How you can simply apply math and physics to art is just amazing.  I'm still studying the math in your Nylon Material at a very slow pace.  Linear algebra and calculus really fascinate me although my math is truly horrid.  I've bookmarked this thread so I can come back to study the BBGlossy shaders when I finally get to take a nice long vacation later this year.  Thank you BB.  You're a genius.



RobynsVeil ( ) posted Sat, 02 October 2010 at 5:52 PM

Heck of a time for my PC to go belly-up... pretty sure it's my graphics card that's gone and pooed itself. Oh well, by Christmas I hope to have an i7 or something equivalent and then I can try all these awesome materials. By then, the i9 or whatever will be out and i7s will be yesterday's news (hoping).

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


Latexluv ( ) posted Sat, 02 October 2010 at 10:00 PM

Quote - Heck of a time for my PC to go belly-up... pretty sure it's my graphics card that's gone and pooed itself. Oh well, by Christmas I hope to have an i7 or something equivalent and then I can try all these awesome materials. By then, the i9 or whatever will be out and i7s will be yesterday's news (hoping).

I hear yah! My graphics card obviously has a problem. For the last couple of months there has been a permanent, very thin lining runing vertically down my screen and just off of center. It hasn't gotten worse, but definitely a signal that my five year old Toshiba wants to kick it. This means I have to get a new laptop and there's nothing but Windows 7 machines out there (mine is and XP Professional). And how the heck do I get my Firefox out of this machine along with all my booksmarks into the new machine? Sure I've got back ups of my Poser programs in my external and I could even possibly run Poser from the external.  Sigh, that's what comes from living out of a laptop I suppose. But I'm afraid this is off topic. Very sorry!

"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

 

 


RobynsVeil ( ) posted Sat, 02 October 2010 at 10:47 PM

Hi LatexLuv:
Here's some tutes for backing up bookmarks and settings... good luck with it. 😄

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


Latexluv ( ) posted Sun, 03 October 2010 at 2:05 AM

Thanks for those links, I will surely check them out. At the moment, it looks like I might not be able to get my new computer until X-mas sales time.

"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

 

 


Nyghtfall ( ) posted Sat, 25 June 2011 at 10:15 PM

Quote - 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.

Where does the material file go?


bagginsbill ( ) posted Sat, 25 June 2011 at 11:08 PM · edited Sat, 25 June 2011 at 11:10 PM

Any where in any runtime you want to put it in. PP2010 will load any kind of poser file from anywhere it finds it.

The official place for material files is in runtime/libraries/materials. I may have the case wrong - just find the folder you have.

I suggest runtime/libraries/materials/BB/BBGlossy.mt5

You could also do what some people (including myself) do. I get my own runtime library in many people's collections.


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)


  • 1
  • 2

Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.