if (sr != null) {
if (sr.getType() == Type.SPECULAR) {
return ScatteredRay.select(sr, 1.0 - w);
} else {
Ray3 ray = sr.getRay();
Vector3 r = ray.direction();
Vector3 in = adjoint ? r.opposite() : v;
Vector3 out = adjoint ? v.opposite() : r;
double pdf = w * strategy.getScatteringPDF(x, v, r, adjoint, lambda) + (1.0 - w) * sr.getPDF();
Color bsdf = inner.bsdf(x, in, out, lambda);
return new ScatteredRay(ray, bsdf.divide(pdf), sr.getType(), pdf, sr.isTransmitted());