Our task is to implement a simple raytracer that will render sphere using raytracing for the GPR5204 module.
Implementation
Some of the class or function we need for the raytracer have already been implemented before so we won't have to implement Rays, Sphere and their intersections, as well as Planes.
To implement the raytracer, this is what we plan to do :
Material
To render the sphere we need to give them a material.
Color
Reflexion index
Light
We need a light in our scene
Position
Intensity
Camera
Position
Up
Right
front
FOV
Raytracer
For the raytracing rendering we need different functions
Reflect() : This function will calculate the reflexion of rays when they hit an object
ObjectsIntersection() : Used by each ray to check intersection with objects in the scene by calling the corresponding intersection function already implemented in the rays. It will loop over evry object in the scene.
RayCast() : cast a ray from the camera origin to the direction of the given pixel position to check interection using the ObjectIntersection method to calculate and return the color that must be displayed. If the ray doesn't hit an object, it will return the color of the background
Render() : This function loop across all the pixels and call the Raycast method to cast a ray for each ot them. This is where all the different step of the raytracing rendering will be called.
What are the types of all the attributes of your classes? Color is 3 32-bit integers or 8-bit integers?
What kind is the light? Point light? What does intensity mean? Is it the radius of the light? Directional light? Then, where is the direction vector stored?
Can you define what shapes are you going to support? You are talking about Ray, Sphere and Planes, but are you going to support them?
How are you going to store the shapes? Sorted by types? Divided by octtree? Bounding volume hierarchy (BVH)?
Raytracer
Introduction
Our task is to implement a simple raytracer that will render sphere using raytracing for the GPR5204 module.
Implementation
Some of the class or function we need for the raytracer have already been implemented before so we won't have to implement Rays, Sphere and their intersections, as well as Planes.
To implement the raytracer, this is what we plan to do :
Material
To render the sphere we need to give them a material.
Light
We need a light in our scene
Camera
Raytracer
For the raytracing rendering we need different functions
Reflect() : This function will calculate the reflexion of rays when they hit an object
ObjectsIntersection() : Used by each ray to check intersection with objects in the scene by calling the corresponding intersection function already implemented in the rays. It will loop over evry object in the scene.
RayCast() : cast a ray from the camera origin to the direction of the given pixel position to check interection using the ObjectIntersection method to calculate and return the color that must be displayed. If the ray doesn't hit an object, it will return the color of the background
Render() : This function loop across all the pixels and call the Raycast method to cast a ray for each ot them. This is where all the different step of the raytracing rendering will be called.