 
 		// TODO
 		int lightidx = aten::cmpMin<int>(path.sampler.nextSample() * lightnum, lightnum - 1);
-		path.targetLight = ctxt.lights[lightidx];
+		path.targetLightId = lightidx;
 		lightSelectPdf = 1.0f / lightnum;
 
-		if (path.targetLight.object.idx >= 0) {
-			path.targetLight.object.ptr = &ctxt.shapes[path.targetLight.object.idx];
-		}
-
-		sampleLight(&sampleres, &path.targetLight, path.rec.p, &path.sampler);
+		auto light = ctxt.lights[lightidx];
+		if (light.object.idx >= 0) {
+			light.object.ptr = &ctxt.shapes[light.object.idx];
+		}
+
+		sampleLight(&sampleres, &light, path.rec.p, &path.sampler);
 
 		const auto& posLight = sampleres.pos;
 		const auto& nmlLight = sampleres.nml;


	aten::vec3 lightPos;
	aten::vec3 lightcontrib;
	aten::LightParameter targetLight;

	real pdfb;



		aten::hitrecord rec;
		bool isHit = intersectBVH(&ctxt, shadowRay, AT_MATH_EPSILON, AT_MATH_INF, &rec);

		auto light = ctxt.lights[path.targetLightId];
		if (light.object.idx >= 0) {
			light.object.ptr = &ctxt.shapes[light.object.idx];
		}
		
		shadowRay.isActive = AT_NAME::scene::hitLight(
			isHit, 
			&light,
			path.lightPos,
			shadowRay, 
			AT_MATH_EPSILON, AT_MATH_INF, 
