 // TODO
 #define CAMERA_NEAR		(0.001f)
 #define CAMERA_FAR		(10000.0f)
-
-__global__ void temporarlReprojection(
+#define CAMERA_EPSILON	(CAMERA_NEAR / (CAMERA_FAR - CAMERA_NEAR))
+
+__global__ void temporalReprojection(
 	const idaten::PathTracing::Path* __restrict__ paths,
 	const float4* __restrict__ aovs,
 	const float4* __restrict__ prevAOVs,

			m_mtxs.init(sizeof(aten::mat4) * AT_COUNTOF(mtxs));
			m_mtxs.writeByNum(mtxs, AT_COUNTOF(mtxs));

			temporarlReprojection << <grid, block >> > (
			//temporarlReprojection << <1, 1 >> > (
				path,
				m_aovs[cur].ptr(),

	cur.w = 1;

	if (isInsideX && isInsideY) {
		int px = (int)(prevPos.x * (width - 1) + 0.5f);
		int py = (int)(prevPos.y * (height - 1) + 0.5f);

		px = min(px, width - 1);
		py = min(py, height - 1);

		const auto pidx = getIdx(px, py, width);

		const auto prevAov = prevAOVs[pidx];
		const auto prevDepth = aten::clamp(prevAov.y, CAMERA_NEAR, CAMERA_FAR);

		if (abs(centerDepth - prevDepth) <= 0.1f
			&& aov.x == prevAov.x)
		{
			float4 prev;
			surf2Dread(&prev, outSurface, px * sizeof(float4), py);

			int n = (int)prev.w;

			// TODO
			n = min(1, n);

			cur = prev * n + cur * path.samples;
			cur /= (float)(n + path.samples);
			cur.w = n + path.samples;
		}
	}

