 			sample, maxSamples,
 			seed,
 			mtxW2C,
-			cam.ptr(),
+			rays.ptr(),
 			shapeparam.ptr(), shapeparam.num(),
 			nodetex.ptr(),
 			primparams.ptr(),

	int sample, int maxSamples,
	int seed,
	aten::mat4 mtxW2C,
	const aten::CameraParameter* __restrict__ camera,
	const aten::ShapeParameter* __restrict__ shapes, int geomnum,
	cudaTextureObject_t* nodes,
	const aten::PrimitiveParamter* __restrict__ prims,

		ctxt.matrices = matrices;
	}

	auto ray = rays[idx];

	aten::hitrecord rec;
	aten::Intersection isect;

	bool isHit = intersectBVH(&ctxt, ray, &isect);

	if (isHit) {
		auto obj = &ctxt.shapes[isect.objid];
		evalHitResult(&ctxt, obj, ray, &rec, &isect);

		aten::vec4 pos = aten::vec4(rec.p, 1);
		pos = mtxW2C.apply(pos);
