dilevin / computer-graphics-ray-tracing

Computer Graphics Assignment about Ray Tracing
1 stars 5 forks source link

Understanding max_t #89

Open villanueva-j opened 13 hours ago

villanueva-j commented 13 hours ago

Hello,

I just wanted to confirm whether my understanding of max_t is correct. I have seen previous issues mentioning this and I know that max_t is the distance from a query point to the light.

However, what I am unsure about is that to me it seems like max_t is always 1. Since the direction vector (unormalized) to the light is just: [light vector] - [query point], then wouldn't the distance from the query point to the light point just be one multiple of the direction vector (i.e. t=1)?

Originally I thought that the length of the direction vector would be max_t, however when creating shadow rays for the blinn_phong_shading task, I feel like having max_t as the length of the direction vector is not correct. Specifically, I call the Light.direction() function to get the direction vector to the light (unormalized). Then, create a shadow ray s = (query point) + t(direction to light). then, we can check if this ray intersects with an object. All objects past max_t won't be considered blocking the light, but my concern is that my shadow ray should already be hitting the light at t=1 so objects blocking the light would have t < 1?

Am I thinking of max_t all wrong?