Вы находитесь на странице: 1из 3

Peter Kihaile, CSC 305 Assn #1

The hitable class is used as the base class for objects/shapes in this implementation and is extended by
other classes. A hitable represents an object that the ray is hitting, and in hitable.h is a hit_record struct.
Hit_record stores data about past ray hits. The stored data is t for where the ray hits the hitable. P is
found by taking the origin of the ray and then adding t multiplied by the direction of the ray. This will
get a vector representing a point on the sphere. The normal is the surface normal to that corresponding
point on the sphere.

Material takes the information from hit record to determine how different materials will scatter light.
Material scatters rays by taking the hit_records tangent and point and a randomizing function to
determine where rays will bounce to. The different materials all scatter light in different ways, and the
attenuation variable is used to represent that. The camera moves in 3d space and decides the angle/view
at which rays are sent to the objects. It also averages out several samples for any given pixel allowing
for objects to have a smoother look.

Ray tracers simulate the transport of light by casting rays onto the pixels of an image. It uses a camera
and a light source for positioning. Rays that are casted down onto the objects are bounced off according
to the positioning of the light source, the camera, and type of object encountered. As stated, this
implementation uses hit records and a randomizing function to provide realistic ray scattering.
Lambertian materials arent as reflective as metal and dielectrics and absorbs rays. Target in this class
finds where rays coming off of the lambertian will go, and scattered carries out and stores the actual
operation of building those rays. For the metal, an extra dimension for reflections are added.
Calculating reflections is just a simple matter of vector math, and those reflected rays are fed into the
scattered = ray(); instruction to store and perform the ray building. Fuzz is then added to
increase/decrease metal shininess. Dielectrics are clear materials that reflect some rays and refract
others like water and glass. The refract and schlick functions are brought in for using with dielectrics.
Schlick is an approximation for reflectivity at a given angle and refraction is the bending of rays.
Attenuation is always 1, and based on whether refract returns true or not scattered will return either
reflected or refracted.
Defocus blur is how ray tracers simulate lenses. Defocus blur is synonymous with depth of field, which
takes into account aperture and focus distance. Focus distance is how far the lens is from objects, and
aperture is how much light is able to get a real camera. To do this, camera is changed so that rays come
from a disk instead of a point. Focus_dist is used to lower or increase the lower_left_corner vector so
as to simulate pulling back or pushing forward the camera.

Вам также может понравиться