IOR from an image texture?


I got a 3D model using a material, which has a color channel of an image-texture-map for IOR.
When I want to allow my renderer to apply such maps through a MDL material I encountered some problems.

for non-metal materials I have seen how to apply the IOR in the example “flex material” in the MDL SDK within the fresnel layer; but for “metal” materials a weighted layer instead of a fresnel_layer is applied.
see here:
there is no IOR. Although I read that for example Gold has an IOR of about 0.470, so metals also could also have an IOR value, right?

When that value is uniform throughout the material, it can be added in
in the material( … ) part:

where “ior” is defined, but how to apply that value if its read from a texture map ?

The material I got has only a solid color, so I could instead use it for that case as uniform color without the texture map access.
I’m not sure, whether there are cases of different IOR per pixel, are there such ?

thank you!

The IOR situation for metals is not so simple. A statement like “gold has an ior of 0.47” i would call wrong

using a single float as an ior is good enough for dielectrics (if you ignore dispersion) but not enough for metals.

First IOR is wavelength dependent. for dielectrics the change over the spectrum is small and is often ignored, but for dispersion effects you would want this covered. flex_material uses the function abbe_number_ior() to introduce the variation for glass .

For metals this is not working. Metals IOR varies greatly over the spectrum. This is actually what makes gold look yellow. But this is even more complex…

has the correct data for gold.
technically IOR is actually a complex number. The real part is what is typically called ior, on the page it is called “n”. the imaginary part of the number is called k. For dielectrics , k is very close to 0 which is why we ignore it, but for metals its so big that we need it for ior computation.

MDL has a bsdf now called “complex_ior_factor” which can be used to create metallic reflections using the complex ior of metals.

Thank you very much for your answer and the clarification about ior of gold.
I did not find “complex_ior_factor” in MDL 1.6 (December 2019) spec.
And I searched in all “metal” examples of vMaterials v1.7.0, but also did not find
any which use “complex_ior_factor”.
Please tell me the prototype of that function and the minimum required MDL version.
Thank You.

My fault, sorry, its

bsdf fresnel_factor(color ior,color extinction_coefficient,bsdf base = bsdf());

p118 of the spec (its defined since MDL 1.4).
Here is an example. Note that this is not perfect, I used a less then perfect conversion from the spectral values to RGB. ( For more details i reccomend )


    export material metal (
    color ior = color(0.19,0.475,1.25),
    color k = color(3.39,2.37,1.84)
 = let {
      bsdf scattering = df::fresnel_factor(ior,k,df::simple_glossy_bsdf(
                        mode: df::scatter_reflect,
                        tint: color(1.),
                        roughness_u: roughness
} in material(
    surface: material_surface(
    scattering: scattering
1 Like