I'm trying to integrate the thin-film interference effect described in the paper "Belcour, L., & Barla, P. (2017). A practical extension to microfacet theory for the modeling of varying iridescence." (https://hal.archives-ouvertes.fr/hal-01518344/document) into my material model, which is based on google/Filament's material model (https://google.github.io/filament/Filament.md.html).
However I'm having trouble trying to understand the way to add them together. Let's say I'm shading a pixel, direct lighting goes like this:
vec3 Fr = specularLobe(); // D * F * V
vec3 Fd = diffuseLobe(); // 1 / PI * diffuseColor
return (Fd + Fr) * light.color * light.attenuation * NoL;
And on the other side, indirect lighting goes like this...
vec3 Fd = diffuseIrradiance() * diffuseColor;
vec3 Fr = specularIrradiance() * DFG();
return (Fd + Fr);
Now, if I want to add the thin film/iridescence layer on top of the base material, in what way does it take into account to bottom layer for all the lighting?
I've been looking at this implementation in UE4 (https://polycount.com/discussion/comment/2604578#Comment_2604578), but they seem to input the result of the BRDF calculation directly into the 'Base Color' of the material, which I really don't think it is what I'm looking for, correct me if I'm wrong...
In this other implementation in Unity (https://github.com/Xerxes1138/Iridescence/blob/master/Iridescence.shader) they seem to account for iridescence in both IBL and direct lighting separately, but the layer base is not taken much into account as far as I know.
Finally, in the paper itself, the following statement is made:
Our extension consists in replacing the classic Fresnel reflectance term, F , by a more complex term, R accounting for all inter-reflections inside the thin-film layer, including constructive and destructive interference effects.
From this I understand that simply by replacing the Fresnel Reflectance with the Airy Reflectance function should do the trick, but again, I'm not sure which would be the appropriate approach to being as physically correct as possible.
(The original supp-code from the paper can be obtained from: https://hal.inria.fr/hal-01518344v2/file/supplemental-code%20%282%29.zip)
Thanks for the help!