public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
WavelengthPacket lambda, double ru, double rv, double rj) {
Vector3 n = x.getNormal();
Vector3 m = microfacets.sample(ru, rv).toCartesian(x.getBasis());
double mdoti = Math.abs(m.dot(v));
double ndoti = Math.abs(n.dot(v));
double mdotn = Math.abs(m.dot(n));
double ni = -v.dot(n) >= 0.0 ? n1 : n2;
double nt = -v.dot(n) >= 0.0 ? n2 : n1;