 	}
 
 	// Make next ray.
-	path.ray = aten::ray(path.rec.p, nextDir);
+	rays[idx] = aten::ray(path.rec.p, nextDir);
 
 	path.mtrlid = path.rec.mtrlid;
 	path.pdfb = pdfb;

		&sampling,
		mtrl,
		orienting_normal,
		path.ray.dir,
		path.rec.normal,
		&path.sampler,
		path.rec.u, path.rec.v);

	}
	
	aten::hitrecord rec;
	bool isHit = intersectBVH(&ctxt, rays[idx], AT_MATH_EPSILON, AT_MATH_INF, &rec);

	path.isHit = isHit;
	path.rec = rec;
