IOR on fresnel

In Mental Ray you can manually set the Fresnel effect in the mia shader, giving values for the 0 degree and 90 degree reflections. AFAIK this is not possible in the VrayMtl and it works instead through the IOR value. So based on that…

1) I would like to add the ability to override the fresnel IOR in the VrayMtl and manually set the 0 and 90 degree reflections, like in the mia shader.

2) until then, is there a table someone knows of that converts IOR values into their corresponding 0 degree and 90 degree values? Like:

IOR:1.33 = 90 degree:100%, 0 degree:0%
and so on…

I’ve seen math formulas (which just hurt my head), but not any kind of conversion table (note that I do not mean a table listing materials and their IOR values).

thanks!

You can get similar effects using the “facing ratio” output of a samplerInfo node, or a VRayFresnel node connected to the reflection color of a VRayMtl material.

Best regards,
Vlado

thanks, that is very creative workaround!

Now I just need to find that IOR conversion table…

In 3dsmax in the mia material shader they actually have a curve representation of the brdf values. If you have Use Fresnel checked, you can change the IOR value and see how this effect the curve. Even though no values are show you can get a rough idea of what value they are.

Neat. Unfortunately, I don’t have Max.

You could download the free 30 day trial just to have a look. No it seems silly to download it just for that bit at least it will give you an idea.

Best,

rich

I was hoping for some chart on the web. Surely such a thing must exist.

I’m not really sure what the point of a table is…

If you want something accurate to a specific ior, then use the fresnel ior. If you don’t want accuracy, but instead a creative falloff… use the samplerInfo into a ramp. Works great. I know, I’m a jerk. But it’s true dammit!

Heya Shark,

On the 3dsmax side we had a similar discussion since someone wanted a method to use sampled brdfs for metals to give a more accurate look. One problem with physically accurate materials is that the material is only providing one part of the look, the lighting and environment is providing the rest. If you have a reference image of the material you want to produce and if you had the exact fresnel ior for the material’s reflection, it doesn’t guarantee that your 3d material will exactly match, unless the environment around your 3d object also matches the reference images environment. Ior values will only get you so far along with the look of a material so you might find it a bit easier to get the result you want by using things like incidence nodes, falloff maps or samplerinfo things. Using a fresnel node might be correct, but using a sampler info node might let you make a nicer image.

Well, I want accuracy and control :slight_smile:
The point of a table is to understand what the affect of a certain IOR would be.

For what it’s worth, here’s a very “ballpark” formula I can observe:
IOR: 1.3 = 0 degree: 0.03, 90 degree 1, brdf curve 4.5
IOR: 1.6 = 0 degree: 0.06, 90 degree 1, brdf curve 4.5
IOR: 1.8 = 0 degree: 0.08, 90 degree 1, brdf curve 4.5
IOR: 2 = 0 degree: 0.2, 90 degree 1, brdf curve 4.5
IOR: 5 = 0 degree: 0.5, 90 degree 1, brdf curve 4.5

I can of course just plug in a value if I had it. But it is not entirely obvious to be what the IOR value of t-shirt would be (I don’t see 50% polyester 50% cotton mix on the table). Yet that value does affect the way rim lights look on a shirt. So the IOR matters quite a bit.

The SamplerInfo/ramp workaround is okay, but does not accurately replicate what the mia shader is doing. That is, fresnel fall off is much faster than the results of a ramp. You can see this pretty easily if you look at the VRay fresnel texture. If the ramp shader gave me an accurate fall off which I could manually adjust, that would be great, but it doesn’t really.

I could do the same workaround using the VRay fresnel texture, but since that works with IOR, we are back to the same issue. So I do hope that the mia manual override for the fresnel will be included in a future release.

The rim lights on a cloth material are not related to any sort of IOR, but to the way the material itself is woven. The mia material approximation (which is actually Schlick’s approximation to the Fresnel formula) is just as inaccurate.

It should not be too hard to derive a formula for the IOR that you need given a normal reflectance value… I will try to post it here a bit later.

Best regards,
Vlado

Just a sort of mini bump for this, as I’d like to get some more info or tricks like sharktacos is after.
(ties into my current fxphd lighting class but it’s mainly for metals as we utilise Schlicks falloff with MR)

In Vray you’ll notice that the SSS shader has a IOR of 1.33 (the same as water). When working on cloth I tend to use a similar IOR -- somewhere between 1.3 and 1.4 is good because I want to have strong spec on the edges (where the edges of the fabric would pick up rim lights) and low spec on the front (since cotton is not shinny). For objects like wood where I want more spec/reflection I might go up to and IOR of 1.6. An IOR of 2 could be good for metal, and 10 would be chrome. These are all very unscientific results based on just “eyeballing” it. It would be quite helpful if vray for Maya had a way to visualize the curve like you can in Max. From what I can observe there is a great deal of change from 1-2 and then it levels off with only minimal change from 2-10.

For MR I find that the Fresnel works very differently. The results look quite wrong in fact (I suspect there is an error somewhere in how it is being implemented in Maya, which would not be surprising since the integration between Mental ray and Maya is notoriously buggy). So I only use the manual BRDF settings. To get the same results as you would with IOR 1.33 and the like, you need to set the BRDF zero degrees to .05 (=5%) rather than the default .2 (=20%) and change the curve from 5 to 3.

Again, all of this is just guess work based on observation. I would be great to have some science to back it up :slight_smile:

I totally second the idea of having a curve repreentation of the resulting reflection distribution (0 to 90 degree) while tweaking IOR for Vray materials, as well as the flexibility to adjust the distribution in the schlick mode. :slight_smile:

We’ve been lucky enough to see close approximations of the real world IOR numbers being tapped into a spreadsheet to show the differences between the fresnel/schlick (& real world) differences in our classes.
Essentially, although with MR, the idea is to stick with fresnel for dielectric/insulator materials, and the schilick curve for metals/conductors.
As someone else suggested perhaps using some ramps will do for now when using vray, although I’d like to get a rough idea what the ramp should look like as a starting point.

Visually, it’s a subtle difference but you can see it, of course when things are worn/dented I think it’s less obvious.

Good, basic illustration on Zap’s blog:

Reviving this thread…

What Zap is saying here is that metals have an IOR of 25 to 50. That’s new to me! I thought they would be IOR 2.0 and that 10 would be as high as you go (a mirror). I’d be interesting in a discussion of this, and an idea of what IOR values various metals have (brass, steel, gold, tin, etc).

Also I’s still be interested to know what IOR values cloth would have, or if it would be more accurate to use a ramp and samplerInfo, then what the shape of the falloff would be.

Nope, I don’t buy that stuff at all.

See that dip down that you get at the right of his curve before it shoots back up? That’s totally wrong. if you have a look at http://refractiveindex.info/?shelf=main&book=Au&page=Rakic all of the data is taken from scans of materials and they give you reflectivity graphs from 0 to 90 degrees. If you look at the graph at the bottom of the page, it gives you one of the curves for gold, and you want to be looking at the green curve in the middle of the graph which shows the reflectivity for visible light (the other two are different types of polarized light). As you can see you get a curve that’s fairly flat for 0 to 50 degrees that then starts curving up to 100% reflectivity at 90 degrees. What you’re not getting is a really flat curve all the way along, then a huge dip down around 80 degrees before shooting back up to 100% at 90 degrees. I think the curve that he was using before with the 0 degree reflectivity, 90 degree reflectivity and curve shape was way more like an actual gold material.

A big difference with metals compared to normal reflective surfaces, is that metals reflect the various colours of light differently. What causes gold to be more yellow / orange for example is that it reflects red light more strongly than it reflects green or blue light and so what you need to do is either make a separate reflection curve for each of the red, green and blue and mix them together before feeding them into the reflection strength in your shader, or use a ramp driven by the facing ratio with colour values along the gradient using the appropriate amount of red green and blue for each of the degrees.

If you want to use the curves, choose a metal at the top of the refractiveindex.info site and then you’ll have to change the wavelength value just underneath the various metal drop down menus. Use 475 nm for your blue curve, 510 nm for green and 650 for red. (Taken from http://science-edu.larc.nasa.gov/EDDOCS/Wavelengths\_for\_Colors.html). Go to the very bottom of the page each time and have a look at the reflectivity curve there. The red and blue curves are for two directions of polarized light (which we don’t see) so you use the green one which is the average of the two and the equivalent of the visible light that we do see. What you’ll find is that the overall shape of the curve is the same for red, green and blue, it’s just that each of them three colour starts from a higher or lower amount. With the gold curve for example, I see it as being nearly flat from 0 to 40 degrees and then starting to curve upwards to 100% at 90 degrees, so you might be able to just use a single colour swatch at the start of your ramp with (0.94, 0.55, 0.4) a second swatch at around position 0.45 (40 degrees divided by 90 degrees to turn it into a percentage so we know where to place the swatch on the ramp) on the ramp with the appropriate amount of red, green and blue for 40 degrees, a totally white swatch at position 1.0 on the ramp and then maybe a fourth swatch at around position 0.77 on the ramp with the right amount of rgb so we get the curve slightly more accurate again.

The last thing is that metal has no diffuse as such - it’s all the one reflective material and the only thing that makes it look more diffuse or not, is how polished or rough the surface is. Some people like to use a bit of diffuse colour to make a duller looking metal which is fine, the only thing to note is that you might sometimes get an odd tint (or at least you do in max) as if you’ve got a red reflection for example, it should reflect all the red parts of light back and only allow the green and blue parts of your light through to shine on your diffuse, thus giving your material a bit of a cyan tint. If you get this, the best thing to do is make one totally diffuse material with your reflection curve in the diffuse slot of your metal, make another material with no diffuse and your reflection curve in the reflection slot of your material and then use a vray material to blend them together making sure you only use grey values in the blend amount colour swatch - this will stop any tinting from happening. The vray material in 3dsmax has options about how reflections and diffuse are blended where you can use rgb (so a red reflection kills all reflections hitting the diffuse) or monochrome (where a red reflection allows red light through, it just dulls down the amount of light that gets through into the diffuse.)

With the refractiveindex.info stuff bear in mind that each of the actual scan data that they have comes from ONE single specific sample of that metal so if you’ve got a gold curve, it means you can replicate that specific type of gold only. There are a tonne of different types of golds in terms of hues and purity which will likely have an influence on it’s colour and likewise a reference image that you might find of a gold you need to replicate might have that gold in an environment that has warmer or cold lighting or has an environment that’s tinting the reflections to be a slightly different colour. The point is to use the curves as a rough guide or starting point and make some adjustments from there.

An IOR of 25 or 50 is wrong. It might come somewhat close but it’s using the formula incorrectly. This is because most renderers use a simplified Fresnel function that’s not meant to be used for metals.

The full Fresnel equation(s) use two variables; n and k. The simple one uses only one; n. This is the ‘IOR’ value. For non-metals the k value is practically zero, so you can discard it and have a much simpler and faster equation. For metals the k value isn’t zero and if you want to be accurate then you would need the full equation.

Have a look at refractiveindex.info for values and curves, it’s a very good site.

I’ll see if I have some time to put together a full Fresnel shader for metals with OSL, I made it in maxscript and c++ so it shouldn’t be too hard.

edit: ah joconnell beat me to it with the site. ; )

Ah!

The very person that clarified all of the metal stuff to me!

You in maya land in the new place Rens?

No back to max again for now, it’s fine after a while. ; ) Enjoying working with maya?

-

On the topic of the Fresnel equations, when you’re using Schlick for metals as mentioned earlier in this thread, basically what you’re doing is using an approximation of a simplified formula made only for non-metals, and use that for metals. Not the most ideal…