dielectricSpecularF0 static method
Vector3
dielectricSpecularF0({})
The dielectric specular reflectance at normal incidence the standard
shader path uses for these inputs, clamp(((ior - 1) / (ior + 1))^2 * specularColor * specular, 0, 1) per KHR_materials_ior and
KHR_materials_specular, which is the same product the physical shader
forms from its material inputs. Returns 0.04 for the defaults.
Implementation
@visibleForTesting
static Vector3 dielectricSpecularF0({
required double ior,
required double specular,
required Vector4 specularColor,
}) {
final clampedIor = math.max(ior, 1.0);
final iorF0 = math.pow((clampedIor - 1.0) / (clampedIor + 1.0), 2.0);
return Vector3(
(iorF0 * specularColor.x * specular).clamp(0.0, 1.0).toDouble(),
(iorF0 * specularColor.y * specular).clamp(0.0, 1.0).toDouble(),
(iorF0 * specularColor.z * specular).clamp(0.0, 1.0).toDouble(),
);
}