Lecture 9: Ray Tracing & Acceleration Structures (31)
keeratsingh2002
In optimizing ray-plane intersections for axis-aligned planes, how do we adjust the calculation if the ray is parallel to the plane? Would there be a scenario where the intersection calculation is undefined, and how is that typically handled in ray tracing algorithms?
JermXT
[deleted]
emily-xiao
In algorithmic optimization, is there a rule of thumb for how much each calculation costs? (e.g. addition and subtraction cost the same, multiplication twice as much and division 10x?)
ninjab3381
@emily-xiao From what I remember division definitely cost the most amount of time. According to chat gpt addition and subtraction are O(n) time where n is the number of bits while multiplication would be assumed to be O(n^2) but with advanced algorithms can be close to O(n^1.6). Division is normally O(n^2) but in some cases can be close to multiplication.
Zackoon
@keeratsingh2002, If the ray was parallel to the plane, before using this equation, you can check if the dot product between the normal and the ray is 0!
Zzz212zzZ
One practice in BBox structure is that the inverse of d is normally stored within its data structure because this can reduce time-consuming divide calculation (every time tmin or tmax is calculated, this inverse of d is used so storing it can also reduce the repeated divide calculation).
In optimizing ray-plane intersections for axis-aligned planes, how do we adjust the calculation if the ray is parallel to the plane? Would there be a scenario where the intersection calculation is undefined, and how is that typically handled in ray tracing algorithms?
[deleted]
In algorithmic optimization, is there a rule of thumb for how much each calculation costs? (e.g. addition and subtraction cost the same, multiplication twice as much and division 10x?)
@emily-xiao From what I remember division definitely cost the most amount of time. According to chat gpt addition and subtraction are O(n) time where n is the number of bits while multiplication would be assumed to be O(n^2) but with advanced algorithms can be close to O(n^1.6). Division is normally O(n^2) but in some cases can be close to multiplication.
@keeratsingh2002, If the ray was parallel to the plane, before using this equation, you can check if the dot product between the normal and the ray is 0!
One practice in BBox structure is that the inverse of
d
is normally stored within its data structure because this can reduce time-consuming divide calculation (every time tmin or tmax is calculated, this inverse ofd
is used so storing it can also reduce the repeated divide calculation).