PBR Journey Part 3 : Clear Coat Model with VTK

February 16, 2021
Figure 1. A carbon sphere rendered with VTK 9.0 using the PBR shader and Image Based Lighting with a HDR environment, without (left) and with (right) a clear coat layer.

Introduction

In our last step on the Physically Based Rendering Journey with VTK, we introduced an anisotropy model to simulate materials that exhibit different reflecting properties depending on the direction of the tangent.

Today, the journey continues with the clear coat model that enables the simulation of a second, dielectric and isotropic layer on top of the object. This layer enables the reproduction of a coating such as paint on materials : the light is reflected on this layer before being transmitted to the base layer.

Concept of Index Of Refraction (IOR)

As this model simulates an interface between two mediums, we need to compute the ratio between the amount of light reflected and transmitted at this interface.

For this, we introduced the concept of Index Of Refraction in VTK. The index of refraction of a medium is a dimensionless number that describes how fast light travels through the material compared to the speed of the light in void.

With VTK, we do not as yet have a way to specify environment refractive index so we assume that the object is only surrounded by pure air, with an IOR of 1.0. Future implementations may consider an other medium to be used as the environment.

These refractive indexes are used to calculate the fresnel reflectance F0, which is the amount of energy reflected at normal incidence (ie. with an angle of 0° with the normal) at an interface between two materials A and B.

Physically, metallic materials are described by measurable complex refractive indexes, leading to a chromatic reflectance. This is what gives the metal its color. As complex IOR are not yet implemented in VTK, we assume that the reflectance F0 is its albedo (ie. the base color of the material, which can be set with `vtkProperty::SetDiffuseColor(r,g,b)`).

At the opposite, dielectrics have real refractive indexes, so F0 is achromatic and is calculated with the formula below.

$latex f_0= \frac{(IOR_a – IOR_b)^2}{(IOR_a + IOR_b)^2}&s=4$

$latex IOR_a$ is the refractive index of the medium a (typically, the base layer), and $latex IOR_b$ is the refractive index of the medium b (typically the coat layer or the environment).

Check out this great refractive index database to select the refractive index that suits your needs. Real materials have an IOR between 1.33 (water) and 2.4 (diamond).

Parameters

This model adds several options to vtkProperty :

  • Coat Strength: Controls the strength of the coat layer, between 0.0 and 1.0. Default is 0.0 (no clear coat). This is set using vtkProperty::SetCoatStrength(). This parameter can be considered as the thickness of the coating.
Figure 2. Comparison of the coat strength. Coat roughness = 0, and coat strength from left to right : 0, 0.3, 0.6, 1
  • Coat roughness: Controls the roughness of the coat layer. Default is 0.0. This is set using vtkProperty::SetCoatRoughness().
Figure 3. Comparison of the clear coat roughness, with clear coat strength = 1, and clear coat roughness from left to right : 0, 0.2, 0.4, 0.6, 0.8
  • Coat color: The color of the coat layer. Specular reflections on the coat layer are always white, but this parameter modifies the radiance that passes through it. Default is white (no modification of the radiance after transmission to the base layer). This is set using vtkProperty::SetCoatColor().
Figure 4. Spheres with coatRoughness=0.1, roughness=0.5, and coatStrength going from 0 (left) to 1 (right)
2 upper lines : Dielectric spheres with a blue coat color
2 lower lines : Metallic spheres with a red coat color
You can notice that the coat color does not influence the specular reflections on the coat layer (always white), but modifies the light color after transmission to the base layer.
  • Base layer IOR : The refractive index of the base layer. Default is 1.5. This is set using vtkProperty::SetBaseIOR().
Figure 5. Carbon texture without clear coat. IOR varies from 1.0 (reflectance = 0) to 2.3 (reflectance = 0.16). You can notice how an increased IOR increases the reflectance, and the amount of light reflected as a consequence.
  • Coat layer IOR : The refractive index of the coat layer. Default is 2.0. This is set using vtkProperty::SetCoatIOR().

If a coat layer is present like in Figure 6, we must recompute the reflectance of the interface base-environment taking the coat layer IOR as the refractive index of the environment. Considering the above formula, it implies that :

  • If the base IOR stays constant but the coat IOR goes up, the reflectance of the base layer – coat layer interface and of the coat layer-environment goes up. The figure 6 demonstrates this behavior.
Figure 6. Carbon texture with base IOR = 1.5 (default), clear coat strength set to 1 and with varying clear coat IOR (from left to right : 1.5, 1.7, 2.0, 2.1 and 2.3). You can notice that increasing the coat IOR increases the specular reflections but can lead to unrealistic results.
  • If the coat IOR is equal to the base IOR then the reflectance of the interface base layer – coat layer will be 0. That means that if you want to add more coat specular reflection without adding base specular reflection, you must set the base IOR equal to the coat IOR, like depicted in the Figure 7 below.
Figure 7. Carbon texture with clear coat strength set to 1 and base IOR set equal to the coat IOR, with coat IOR, from left to right = 1.5, 1.7, 2.0, 2.1 and 2.3. You can notice how the base layer stays dark compared with figure 6.
  • Edge Tint : The fresnel reflectance F0 is the amount of light reflected at normal incidence (ie. with an angle of 0° with the normal). Similarly, a fresnel reflectance F90 exists which is the amount of light reflected at grazing angles (ie. with an angle of 90° with the normal). As F90 is always 1.0 (and achromatic) for dielectrics, it is chromatic for metals and can now be parameterized by setting vtkProperty::SetEdgeTint. This property sets the color of the reflection on the edges of a metallic material.
Figure 8. Metallic copper spheres with default edge tint (white, left), yellow edge tint (middle) and red edge tint (right). You can notice subtle tints at the edges of the sphere.

What’s next

Clear coat model will be available in ParaView 5.10 and in nightly builds.

A lot of things can be done to enhance the rendering in VTK. What we have in mind:

  • Complex IOR for metals
  • Ability to change the refractive index of the environment
  • Subsurface scattering
  • Emissive bloom

And a lot more ! Stay tuned !

Acknowledgements

This work is funded by an internal innovative effort of Kitware Europe.

Leave a Reply