Using Complex Index of Refractive Data in Karma/MaterialX

   945   4   2
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
Hello,

The attached .txt file was downloaded from https://refractiveindex.info, a resource that provides detailed Refractive Index (n) and Extinction Coefficient (k) data, essential for accurately simulating how glass interacts with light across various wavelengths.

As far as I know, Houdini doesn’t natively support importing this type of data directly, and I’ve submitted a feature request to SideFX. However, I’m reaching out to see if I’m overlooking any workflow or method that would allow me to incorporate this data into my glass shaders using Karma and MaterialX.

Any suggestions or insights would be greatly appreciated.

Attachments:
N-BK7.txt (2.7 KB)
ior-data.png (93.9 KB)

User Avatar
Member
8043 posts
Joined: 9月 2011
Offline
Complex fresnel is only supported with the metallic lobe (conductor bsdf) of the standard shader, but parameterized there as F0 and F90 reflectivity. There's a node which converts this parameterizion to complex ior, but there is none for going to the other way. It's a shame because finding tables for this "artistic reflectivity" for complex fresnel is nearly impossible.

Either way, it doesn't matter as complex ior is not implemented in the glass bsdf. Fortunately, the complex component is only a vanishingly small effect for dielectrics, unless you are taking into consideration polarized light and using spectral rendering, of which Karma does not implement either.
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
jsmack
Complex fresnel is only supported with the metallic lobe (conductor bsdf) of the standard shader, but parameterized there as F0 and F90 reflectivity. There's a node which converts this parameterizion to complex ior, but there is none for going to the other way. It's a shame because finding tables for this "artistic reflectivity" for complex fresnel is nearly impossible.

Either way, it doesn't matter as complex ior is not implemented in the glass bsdf. Fortunately, the complex component is only a vanishingly small effect for dielectrics, unless you are taking into consideration polarized light and using spectral rendering, of which Karma does not implement either.

Thank you for that response. It really clarifies the current limitations with Karma and MaterialX regarding complex Fresnel for dielectrics. It’s unfortunate that complex IOR isn’t supported in the glass BSDF, though I understand that the impact is minimal in most dielectric materials, especially without spectral rendering or polarized light simulation. I appreciate the insight on the metallic lobe and the conversion process to complex IOR, even though it’s geared toward conductors. For my project, I was hoping to find a more direct method to leverage the refractive index data from the .txt file to fine-tune the realism of glass in Karma, but I see that we’re somewhat restricted by the current shader implementation. I'll continue exploring potential workarounds until native support or a more fitting solution emerges. Thanks again for the help—this clears up a lot for me.
User Avatar
Member
105 posts
Joined: 7月 2019
Offline
I guess modern engines with PBR shaders have deliberately moved away from calculating the complex IOR with an imaginary part (k) for non-metals because the values for non-metals are too small to make a significant difference. When comparing the imaginary refractive indices of metals and glass, the range for metals can vary from 1 to 14, while for glass, it ranges from 2.8607E-06 to 8.1300E-06 (0.0000028607 to 0.0000081300). These are incredibly small values, and I doubt whether rendering engines even calculate to such precision, as these minuscule differences likely don’t have a noticeable impact on the final render.

In the Physically Based Rendering book [pbr-book.org], it is clear that the Fresnel function for conductors (metals) uses the complex refractive index, including the imaginary part k, which accounts for light absorption.
In contrast, FresnelDielectric function is not using it.
So, this likely applies to all engines that implement similar technology, as using the imaginary part for dielectrics does not provide significant benefits and only increases computational overhead.
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
FaitelTech
I guess modern engines with PBR shaders have deliberately moved away from calculating the complex IOR with an imaginary part (k) for non-metals because the values for non-metals are too small to make a significant difference. When comparing the imaginary refractive indices of metals and glass, the range for metals can vary from 1 to 14, while for glass, it ranges from 2.8607E-06 to 8.1300E-06 (0.0000028607 to 0.0000081300). These are incredibly small values, and I doubt whether rendering engines even calculate to such precision, as these minuscule differences likely don’t have a noticeable impact on the final render.

In the Physically Based Rendering book , it is clear that the Fresnel function for conductors (metals) uses the complex refractive index, including the imaginary part k, which accounts for light absorption.
In contrast, FresnelDielectric function is not using it.
So, this likely applies to all engines that implement similar technology, as using the imaginary part for dielectrics does not provide significant benefits and only increases computational overhead.

You're spot on. The imaginary part of the refractive index (k) for non-metals like glass is so small that most engines skip it in PBR shaders to avoid unnecessary computational load without impacting the final look. For metals, though, it's crucial since it affects light absorption and reflection, which is why it’s included.

That said, while the difference for non-metals is often negligible, omitting it entirely could still hurt render accuracy in extreme cases where absolute realism is desired.
Edited by JosephH2024 - 2024年10月8日 23:53:17
  • Quick Links