-
Notifications
You must be signed in to change notification settings - Fork 0
3. Ray Tracing
The goals of this assigment are:
- Develop the key structures and functions for rendering algorithms.
- Link mathematical concepts with practical code.
- Be a test benchmark for potential new primitives, sensors or acceleration structures.
The rays cast from a sensor camera model. The model followed is a pinhole camera (see Figure 1). Bear in mind that the size of the projection plane (given by the up and left vectors) is proportional to the resolution of the image (in pixels). Otherwise the geometry appears distorted according to the aspect ratio. The boundaries of each pixel (related to the projection plane’s size and theimage resolution) are calculated in order to cast multiple rays per pixel. The number of rays per pixel is a command line parameter.
The geometry consists on the following primitives:
- Sphere:given by its center and radius.
- Planes: infinite plane given by its normal and its distance to origin.
Each primitive can be intersected with a ray: this results into a system of equations in which the ray has the equation of a line and the specific geometry has its implicit equation.The system is solved by substitution to get the parameter of a ray. Additional to its geometrical information, each primitive have an emission property, a red-green-blue tuple, which represents the color of the primitive.
The application is a renderer that casts a single ray per pixel and puts in the corre-sponding pixel coordinate the emission of the closest intersected primitive. The scenes are hardcoded in the source code. The image is saved for further visualization. Some tests have been done to verify the effect of the number of objects and the image resolution onthe rendering time.
These images are examples of testing images to verify how the ray tracer works: