eonLobe static method

Vector3 eonLobe(
  1. Vector3 rho,
  2. double r,
  3. double muI,
  4. double muO,
  5. double lDotV,
)

EonLobe: EON for the diffuse colour rho, divided by π.

Implementation

static Vector3 eonLobe(
  Vector3 rho,
  double r,
  double muI,
  double muO,
  double lDotV,
) {
  final s = lDotV - muI * muO;
  final sOverT = s > 0.0 ? s / math.max(muI, muO) : s;
  final single = 1.0 / (1.0 + _fonA * r) * (1.0 + r * sOverT);
  final average = _fonAverageAlbedo(r);
  final shape =
      math.max(1.0 - _fonAlbedo(muO, r), 1e-7) *
      math.max(1.0 - _fonAlbedo(muI, r), 1e-7) /
      math.max(1.0 - average, 1e-7);
  double channel(double c) =>
      (c * single + _eonMulti(c, average) * shape) / _pi;
  return Vector3(channel(rho.x), channel(rho.y), channel(rho.z));
}