 				}
 			}
 			else {
-				if (intersectAABB(&bvhray, aabb, t)) {
+				//if (intersectAABB(&bvhray, aabb, t)) {
+				if (aten::aabb::hit(r, boxmin, boxmax, t_min, t_max, &t)) {
 					stackbuf[stackpos++] = (int)node.x;
 					stackbuf[stackpos++] = (int)node.y;
 


		auto mtxW2L = ctxt->matrices[param.mtxid * 2 + 1];

		aten::ray transformedRay;
		transformedRay.org = mtxW2L.apply(r.org);
		transformedRay.dir = mtxW2L.applyXYZ(r.dir);
		transformedRay.dir = normalize(transformedRay.dir);

		if (intersectBVH(ctxt->nodes[c.exid], ctxt, transformedRay, t_min, t_max, &isectTmp, IntersectType::Closer)) {
			if (isectTmp.t < isect->t) {

		isect,
		IntersectType::Closer);

	aten::ray transformedRay;
	int previd = -1;

	for(int i = 0; i < candidateNum; i++) {
		const auto& c = candidates[i];

