karansher / computer-graphics-ray-tracing

Computer Graphics Assignment about Ray Tracing
0 stars 0 forks source link

Differentiating specular and diffuse objects. #28

Open DerekCresswell opened 2 years ago

DerekCresswell commented 2 years ago

So after today's lecture I'm trying to make my ray tracing only reflect if an object is specular. In the lecture we were not told how you might make this distinction.

My first thought is to just see if the norm of the ks vector is small. However, the mirror given in the data file has a small ks despite the fact that it should be very reflective! Now I am confused as to how you would differentiate these objects.

panuelosj commented 2 years ago

The ks is given as a factor, ie 1.0 will reflect 100% of a given colour, 0.1 will reflect 10%. You want to make a reflected ray anytime ks is nonzero.

DerekCresswell commented 2 years ago

Oh, ok. The obvious answer is the best answer.

scissorkhizer commented 2 years ago

Do we also need to check whether the mirror color is non-zero as well? As in we generate a reflected ray only if both specular and mirror colors of the object are non-zero? I only ask because the textbook mentions it at the end of 4.8.

Edit: Nvm it should be helpful to check if km is also non-zero because then you don't need to recurse and add a negligible change to the ray's color if it does.