RE_Direct_Physical top-level property

dynamic RE_Direct_Physical
getter/setter pair

Implementation

var RE_Direct_Physical = ShaderNode((inputs) {
  var lightDirection = inputs.lightDirection;
  var lightColor = inputs.lightColor;
  var directDiffuse = inputs.directDiffuse;
  var directSpecular = inputs.directSpecular;

  var dotNL = saturate(dot(transformedNormalView, lightDirection));
  var irradiance = mul(dotNL, lightColor);

  irradiance = mul(irradiance, PI); // punctual light

  addTo(directDiffuse, mul(irradiance, BRDF_Lambert({diffuseColor})));

  addTo(
      directSpecular,
      mul(
          irradiance,
          BRDF_GGX({
            "lightDirection": lightDirection,
            "f0": specularColor,
            "f90": 1,
            "roughness": roughness
          })));
});