message: sample the complete sphere if no dg.N is 0
diff: @@ -36,9 +36,17 @@ Light_SampleRes AmbientLight_sample(const uniform Light* uniform super,
  uniform AmbientLight* uniform self = (uniform AmbientLight* uniform)super;
  Light_SampleRes res;
  + if (reduce_max(abs(dg.Ns)) > 0)
  + {
  const vec3f localDir = cosineSampleHemisphere(s);
  res.dir = frame(dg.Ns) * localDir;
  res.pdf = cosineSampleHemispherePDF(localDir);
  + }
  + else
  + {
  + res.dir = uniformSampleSphere(1.f, s);
  + res.pdf = uniformSampleSpherePDF(1.f);
  + }
  res.dist = inf;
  res.weight = self->super.radiance * rcp(res.pdf);
  @@ -55,7 +63,10 @@ Light_EvalRes AmbientLight_eval(const uniform Light* uniform super,
  Light_EvalRes res;
  res.radiance = inf <= maxDist ? self->super.radiance : make_vec3f(0.f);
  + if (reduce_max(abs(dg.Ns)) > 0)
  res.pdf = cosineSampleHemispherePDF(max(dot(dg.Ns, dir), 0.f));
  + else
  + res.pdf = uniformSampleSpherePDF(1.f);
  return res;
  }
  