alecjacobson / computer-graphics-ray-casting

Computer Graphics Assignment about Ray Casting
30 stars 28 forks source link

what is min_t? #14

Closed AllenLXL closed 6 years ago

AllenLXL commented 6 years ago

In every intersection function, I know how to compute $t$ but I don't understand what is min_t and how to use it. Can someone explain it. Thanks! (๑¯∀¯๑) I know in .h file it's description is "minimum t value to consider (for viewing rays, this is typically at least the parametric distance of the image plane to the camera)".

velociraptor111 commented 6 years ago

min_t is a variable that acts as some sort of threshold so that when an object is detected at some t1 this t1 makes sense.

Most of the time you see min_t is set to 1, and the reason for this is because at time t=1, your ray is assumed to be at the image plane. HENCE, it only makes sense for your ray to intersect an object after this image plane.

In other words, you will check to see if your t1 > min_t . If this condition is not satisfied, this means that your ray is intersecting "something" in between your ray.origin and the image plane WHICH you could safely ignore ...