Skip to content

PBR: Clear coat layer implementation

Paul Lafoix requested to merge paul.lafoix/vtk:ClearCoatPBR into master

Update PBR shader in vtkOpenGLPolyDataMapper to simulate a clear coat layer (upside layer on the material). This layer is supposed dielectric (achromatic reflections) and usually with low roughness, so it adds only a specular lobe to the previous diffuse and specular parts of the base material. The specular BRDF model of the coat layer is a Cook-Torrance specular microfacet model, with a GGX normal distribution function, a Smith visibility function, and a Schlick Fresnel function. Notice that it uses the exact same specular microfacet model as the base layer specular BRDF.

This adds multiples parameters to vtkProperty :

  • CoatStrength : [0-1], default to 0.5. Controls the strength (0 means no layer)
  • CoatRoughness : [0-1], default to 0. 0 means smooth layer (high specular reflection)
  • CoatIOR : [0-4], default to 1.5. Defines the material IOR of the layer. The more the IOR is high, the more the reflectance goes up. That means that with a higher value of IOR, the coat layer will have more specular reflections.
  • CoatColor : Default to white.
  • CoatNormalScale : Scales the normal map (if present)
  • BaseIOR : the base material index of refraction. When we add a coat layer, we need to recalculate the reflectance of the interface between the base material and the exterior, as the new exterior is now the coat layer. The precomputation of the reflectance is done in vtkOpenGLPolyDataMapper.
  • NormalTex : the normal texture of the coat. If not presents, we assume the layer has the same normal map as the base material.

Add a file vtkPBRFunctions.glsl to hold actual (and future) PBR functions.

carbonComp

Comparison between a carbon texture without clear coat (left) and with clear coat with a default coat IOR of 1.5 (middle), and with an coat IOR of 1.7 (right). You can notice that increasing the coat IOR increase the specular reflections but can lead to unrealistic results.

Comparison with ospray :

ospray

Edited by Paul Lafoix

Merge request reports