A ray tracer application for rendering scenes with different objects, surfaces and lights. The application uses mathematics and linear algebra to simulate materials and light. Uses SDL2 for pixel rendering
An application that implements ray tracing from scratch using mathematics and linear algebra to render object of different shapes,materials, shininess , colors, and reflectivity in 3D scene.
How the application works.
The application first places different object in the a 3D plane. The light sources and camera are placed at specific position whereas the other objects and planes are initially placed at the origin then later transformed and translated using matrix operations.
Different objects and their reflexitivity,shininess and colours are all modelled using linear algebra and mathematics.
Clone the project and replace the SDL2PATH variable in the makefile with the absolute path of where the SLD2 folder was extracted,
using CMake, run command 'make'
THe following are screenshots of the different stages of development.
The 2D rendering
Calculating and rendering a 3D sphere on a 2D screen
Rendering 3D image onto a 2D screen
Vector equation of a sphere
Simplifying the equation
Implemented sphere from the maths and rendered into the scene.
Calculating the shadows and shininess in relation to a source light
Using dot product to get the angle between the light source and a point on the sphere
Implementation of the maths.
Transforming objects using translation, rotations and scaling matrices.
The different matrices that are used to translate, rotate and scale unit sphere centred from the origin.
Implemented the maths. The three objects are derived from unit radius spheres centred at the origin
Implementing a plane
Plane vector
Equation for finding point of intersection with a plane
Implementation
Implemented shadowing on the plane
Made correction to the shadowing to make it realistic
Introduced different sources of lights placed at different positions and having different colors.
Calculated and introduced different materials having different specular, shiness and reflectivity values
Material diffusion vectors and the point of intersections
Specular vectors and intersection equations
Reflection vectors and the intersection equations
implementation
Introducing Cylinders and Cones
About
A ray tracer application for rendering scenes with different objects, surfaces and lights. The application uses mathematics and linear algebra to simulate materials and light. Uses SDL2 for pixel rendering