GPU Compatible Thin-Film Interference v2.1: Glass Within Glass + Absorption

Hi, this thread was both beautiful and very informative!

I have attempted to make a thin film interference node group in Cycles, but ran into troubles when it came to my understanding of complex IOR. I have created a system which allows you to render spectral images in Cycles, and define materials dependent on the specific wavelength. (Can be found here)

In terms of implementing thin film interference in my spectral environment, I ran into the issue of being able to deal with interaction of the primary reflection and the reflection off the underneath material. For example, a bubble goes from an IOR of 1 to ~1.33, then back to 1 inside the bubble, but for a thin film over polished metal, the destructive interference depends on the reflection spectrum of the metal underneath - that’s where my system fell apart.

Does this implementation deal with that? It could be that the math of my implementation is just too simplistic, but I feel like this would have to be done in code because it would need to ‘look’ at the result of the underneath shader before determining the colour to display.