Vector3 v = x.getPosition().unitVectorFrom(p);
Vector3 n = context.getShadingNormal();
double d2 = x.getPosition().squaredDistanceTo(p);
double atten = Math.max(n.dot(v), 0.0) * totalWeight / (4.0 * Math.PI * d2);
Color ri = mat.emission(context, v, lambda).times(atten);
LightSample sample = new PointLightSample(x, p, ri);
target.addLightSample(sample);
}
public LightNode sample(PathInfo pathInfo, double ru, double rv, double rj) {