Tuesday, November 5, 2019

CST 325 W2

This week, we learned about raytracing. We wrote the code for the basic raytracer and used diffuse shading using the Lambert term. We then created shadows from light occlusion and used vector operations for image generation.

Raytracing uses a camera, image, object, view ray, and shadow ray. We trace the ray from the camera through each image block resulting in the following. The ray will hit the sphere, the plane, both, or none. When the ray hits the sphere and plane, only the closest is used. If an object is between the ray and the light, light is occluded and the object casts a shadow. Lambert's Law states that the intensity of the reflected light is related to it's orientation. The greater the angle of the cosine between the light ray and surface, the less intense light. If the cosine of the angle is 1, the surface is facing the light and is fully lit, if its 0, it points away and is not lit. If it's between 0 and 1, it depends on the intensity but is partially lit. When the ray hits the sphere, it will cast a shadow on the plane. If d1 is the distance from the eye to the object and d2 is the distance from the eye to the light; if d1<d2, there will be a ray intersection and a shadow. If d1>d2, there will be a ray intersection but no shadow. In other words, if it can see the light, the shadow is based on the angle, if it doesn't, it will be set to black.

No comments:

Post a Comment

cst 499 week 8

This week, we finished writing the paper in order to do the best job possible even if it was a little bit late. Now that everything is done,...