Clearcoat discoloration of metallic object

I try to use ClearCoat to enhance material effects and found some weird behavior I can’t understand.
When setting ClearCoat on a metallic PBRMaterial the color shifts. If you increase the ClearCoat IOR it gets even worse. There is no tint applied.
Is this intended behavior or a bug in the color computation?

Steps to reproduce:

  • Have an environment texture for PBR IBL
  • Make a metallic PBR material
  • Set the albedo color to something like a darker blue
  • Set clearCoat.isEnabled = true
  • Increase clearCoat.indexOfRefraction for maximum effect

Demo Playground: Babylon.js Playground

Do I get something wrong here? Thanks in advance

Pinging @sebavan

This looks all correct to me:

From the bootom:

  • the first one is a pure mirror
  • the second has an albedo shift so the metal color is impacted
  • the third one, we can see through the center the base and at grazing angle the reflection from a white coating explaining the shift
  • the fourth one is impactin the fresnel by changing the ior so we see more of the white coating outside of grazing angles

Thanks for your explanation. That makes perfect sense to me. So the reflection from the clearcoat should be neutral colored on top. The more I increase the IOR the more that reflection covers the sphere.

But when I dial up the numbers the effect becomes more visible.
IOR: 3, cc+mat roughness 0, just different albedo

From bottom to top:

  • mirror
  • clearcoat, intensity 1, albedo: black
  • clearcoat, intensity 1, albedo: dark red
  • clearcoat, intensity 1, albedo: pure red

The black one behaves as expected.
The clearcoat reflection color of the dark red one gets shifted to the complementary color, cyan.
The clearcoat reflection color of the pure red one gets shifted to red. Maybe the base shining through.

I know these numbers are way over the top… is that still representative?

yup cause we are basically remapping the base layer IOR which won t be the default one due to the interaction with the top layer:

Sorry, I still don’t get the color change.
I try to understand and did some research as well as looking through the code… The interactions of clearCoat and basic material seems pretty reasonable to me. Also how the IOR influences the impact of the clearCoat based on fresnel.

Problem is: I still don’t understand what causes the color shift and differences in my examples. The only thing I could think of would be emulating thin film interference. But when you apply a regular clear coat / transparent varnish on a metal object it wouldn’t cause the percepted color to shift in my experience. Also I couldn’t find anything on that topic.
Sorry for asking so stupid but if it is intentional, could you link me some info on how this is caused in reality?

Here is the part related to the remapping:

Sorry for the late response. I still had to dig a bit to understand and am still not completely sure if I got it right.
What I gathered is as follows:

  • The filament guide states in 4.8.5 to Use values with a luminosity of 67% to 100% (170-255 sRGB) for metallic materials. So the colors that I chose for the examples are very unrealistic for real metals. F0 is the base color of the metal and the list in shows colors that are in the mentioned specs.
  • IOR values for realistic clear coat are mostly around 1.5, maybe between 1.3 and 1.6. The high values from my examples are very unrealistic for real materials so they cannot be compared to the real thing. 4.9.1 states that air-polyurethane interface has an IOR of 1.5.

I verified that the materials look somehow like I would expect when I stick to these rules.

As far as I could understand the color shift occurs because of a shift in the wavelength of the reflected light. It is mainly caused by refraction through the clear coat with far too high IOR values + too dark F0 colors. So if I try to use this as a boost for an effect the color shift is to be expected and not a bug.

Does this sound about correct? If so maybe someone can transfer this topic to Questions. It is not a bug but the information can be useful to others with that problem.

1 Like

I guess it is exactly this :slight_smile: