Support Forum       G3D Web Page     
Variables
glsl::VoxelSurface_pixel_glsl::glsl Namespace Reference

Variables

class {
}; 
 
Our ray-box intersection More...
 

Variable Documentation

◆ @77

class { ... }


Our ray-box intersection

Parameterized on three macros (can be const in bool GLSL, but that changes the signature of the function):

RAY_CAN_START_IN_BOX : You can avoid three operations if you know that the ray origin is outside of the box. That's true for scenes modeled from opaque objects.

In the general case of transparent objects (or two-sided boxes), you need to test for this case and flip the sense of the backface test when the ray is in the box. Note that if all that you care about is the intersection itself (e.g., you're doing BVH traversal without looking at the distance), then the answer is always "yes, the ray hits the box", since you're inside of it, and this isn't necessary.

If a distanceToPlane is negative, then the intersection is behind the ray origin and we want to ignore it. If a distance is positive, then we need to find the intersection point and see if the hit is in bounds. Because we're only considering front faces and boxes are convex, we don't have to see which intersection occurs first–any intersection with a face must be the only one.


documentation generated on Wed Nov 24 2021 08:02:04 using doxygen 1.8.15