dilevin / computer-graphics-ray-tracing

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

Strange inside-a-sphere result #71

Closed milomg closed 1 month ago

milomg commented 1 month ago
Screenshot 2024-09-27 at 11 57 45 AM

Some important constants I use: raycolor(ray,1e-4,objects,lights,0,rgb); - from main.cpp (the same constant is passed into recursive calls)

I add + 1e-9 * n to the shadow_ray and the mirror_ray

I do first_hit(shadow_ray, 1e-4, ...)

I stop raycolor when num_recursive_calls > 5

Possibly related to #69

FalakR commented 1 month ago

Same, I am also getting something similar but incorrect obviously

Screenshot 2024-09-28 at 12 30 19 AM
pranavrao145 commented 1 month ago

I'm also having a similar issue, if I keep the default min_t to first_hit (which I believe is 1.0), I'm able to get the same as @FalakR above, but if I use min_t = 1e-4 or some small number, I get the picture from the original issue.

racheldengg commented 1 month ago

I had a similar issue and it turns out that my shadow ray was not normalized in bling_phong_shading.cpp before I passed it into first_hit

milomg commented 1 month ago

Thanks, that worked! (and that also explains why it wasn't working, the t values that I was comparing wasn't comparing distances correctly because velocity was different)