Computer graphics in Game development
Ivan Belyavtsev
22.02.2020
float3 invRaydir = float3(1.0) / ray.direction;
float3 t0 = (aabb_max - ray.position) * invRaydir;
float3 t1 = (aabb_min - ray.position) * invRaydir;
float3 tmin = min(t0, t1);
float3 tmax = max(t0, t1);
return maxelem(tmin) <= minelem(tmax);
[1]
Traversing AABB before internal triangles gives a good speed up
1. McGuire M. The graphics codex. 2.14 ed. Casual Effects, 2018.