Post by henrai on Mar 28, 2022 9:33:35 GMT
Hi, I’m working on the Chapter 8 of the book.
After I add add the point_offset, I’m still able to see acne:
In the image above, I remove all balls to make things easier. I notice that for some of the hit point falls into the walls after transformation.Therefore it will have very small t (but greater than the epsilon) for the intersection. But I'm sure my previous unit test are not broken.
I try to look into one pixel of the shadow:
I have no idea why the ray origin goes into the unit sphere after doing the transformation.
May I get some suggestion to debug my code? Any suggestion is appreciate.
Btw, I make all tests pass except “The Color with an intersection behind the ray”. Could some one explain that why this case can pass with the shadow? I think the light should be blocked by the outer ball.
Here is my github repo: github.com/Henrai/TheRayTracingChallenge
After I add add the point_offset, I’m still able to see acne:
In the image above, I remove all balls to make things easier. I notice that for some of the hit point falls into the walls after transformation.Therefore it will have very small t (but greater than the epsilon) for the intersection. But I'm sure my previous unit test are not broken.
I try to look into one pixel of the shadow:
comps:
Hit outside
normalV * EPSILON(0.00001): V(7.06722e-06, 4.86935e-09, -7.07491e-06)
hit Point: P(-3.07994, 3.90443, 1.90872)
over point: P(-3.07994, 3.90443, 1.90871)
Start shadow test
ray originP(-3.07994, 3.90443, 1.90871)
transformation matrix of object
| 7.07107, -0.00707107, 3.09086e-07, 0 |
| 0, -4.37114e-10, -10, 0 |
| 7.07107, 0.00707107, -3.09086e-07, 5 |
| 0, 0, 0, 1 |
inverse:
| 0.0707107, -0, 0.0707107, -0.353553 |
| -70.7107, -4.37114e-06, 70.7107, -353.553 |
| 3.09086e-09, -0.1, -3.09086e-09, 1.54543e-08 |
| -0, 0, -0, 1 |
ray origin after transform:
P(-0.436372, -0.802948, -0.390443) // note this point is inside the unit sphere
-0.0690937 0.000327405 // get a hit here
Hit outside
normalV * EPSILON(0.00001): V(7.06722e-06, 4.86935e-09, -7.07491e-06)
hit Point: P(-3.07994, 3.90443, 1.90872)
over point: P(-3.07994, 3.90443, 1.90871)
Start shadow test
ray originP(-3.07994, 3.90443, 1.90871)
transformation matrix of object
| 7.07107, -0.00707107, 3.09086e-07, 0 |
| 0, -4.37114e-10, -10, 0 |
| 7.07107, 0.00707107, -3.09086e-07, 5 |
| 0, 0, 0, 1 |
inverse:
| 0.0707107, -0, 0.0707107, -0.353553 |
| -70.7107, -4.37114e-06, 70.7107, -353.553 |
| 3.09086e-09, -0.1, -3.09086e-09, 1.54543e-08 |
| -0, 0, -0, 1 |
ray origin after transform:
P(-0.436372, -0.802948, -0.390443) // note this point is inside the unit sphere
-0.0690937 0.000327405 // get a hit here
May I get some suggestion to debug my code? Any suggestion is appreciate.
Btw, I make all tests pass except “The Color with an intersection behind the ray”. Could some one explain that why this case can pass with the shadow? I think the light should be blocked by the outer ball.
Here is my github repo: github.com/Henrai/TheRayTracingChallenge