This project was carried out during our second year at EPITECH in C++.
To launch the raytracer program, follow these commands from the root directory of the repository:
make fclean
make
./raytracer [options] > [output_imahe_path]
Available options:
- (
-h/--help): Display the help menu - (
-s/--scene)[configuration_file_path]: Specify the path of the target configuration file (required) - (
-t/--threads)[threads_number]: Specify the number of threads (1 by default) - (
-q/--quality)[samples_number]: Specify the number of samples to adjust the quality (100 by default) - (
-g/--gui): Launch the program with the Graphic User Interface
NOTE: If GUI flag is specified, no output_image_path is required.
Each scene rendered in RayTracer program is described in an config file with the .scene extension, stored in the /scenes directory.
The config file includes:
- Camera's settings
- Materials used for shapes rendering
- Shape to render
- Potential transformations applied to shapes
NOTE: Some comments could be added in the config file with the
#caracter
Here an example of camera configuration:
camera:
{
resolution:
{
width = 1920;
height = 1080;
}
position:
{
x = 0.0;
y = 6.0;
z = -40.0;
}
fieldOfView = 60.0; # In degree
maxDepth = 50;
focusPoint:
{
x = 0.0;
y = 5.0;
z = 0.0;
}
sceneBackground:
{
r = 0.0;
g = 0.0;
b = 0.0;
}
samples = 100;
}
The camera's settings are:
resolution: Requiredposition: RequiredfieldOfView: In degree. Optional, 45° by defaultmaxDepth: Optional, 50 by defaultfocusPoint: Optional, (0, 2, 0) by defaultsceneBackground: (the background color). Optional, (0, 0, 0) by defaultsamples: Optional, 100 by default
Here an example of materials configuration:
materials:
{
lambertian_material:
{
type = "lambertian";
color = { r = 255.0; g = 255.0; b = 0.0; }
}
metal_material:
{
type = "metal";
fuzziness = 0.8;
color = { r = 128.0; g = 128.0; b = 128.0; }
}
light_material:
{
type = "lightDiffuse";
color = { r = 255.0; g = 255.0; b = 255.0; }
}
chessboard:
{
type = "chessBoard";
color1 = { r = 255.0; g = 255.0; b = 255.0; }
color2 = { r = 0.0; g = 0.0; b = 0.0; }
}
}
All materials used to render primitives must be defined in this section.
The material's settings are:
name: Material name (name of the section. Examplelambertian_material)type: Material type (lambertian,metal,lightDiffuseorchessBoard)color: Material color (orcolor1andcolor2forchessBoard)fuzziness: Only formetaltype
Here an example of primitives configuration:
primitives:
{
wall:
{
type = 5;
origin = { x = 0.0; y = 24.99; z = 0.0; };
material = "light_material";
axis = "Y";
height = 5.0;
width = 5.0;
}
sphere:
{
type = 0;
origin = { x = 8.0; y = 2.0; z = 2.0; };
material = "metal_material";
radius = 2.0;
}
plane:
{
type = 1;
origin = { x = 0.0; y = 0.0; z = 0.0; };
material = "lambertian_material";
axis = "Y"
}
All rendered primitives are defined in this section.
The primitive's settings are:
name: Primitive name (name of the section. Examplewall)type: Primitive type- 0 for a sphere
- 1 for a plane
- 2 for a cone
- 3 for a cylinder
- 4 for a cube
- 5 for a wall
origin: Primitive positionmaterial: Assigned material (specified by its name)- Additonal properties specific to a primitive
radiusfor sphere typeaxisfor plane typeaxis,radiusandanglefor cone typeaxisandradiusfor cylinder typexDim,yDimandzDimfor cube typeaxis,widthandheightfor wall type
Here an example of transformations configuration:
transformations:
{
sphere: { type = "translate" ; vector: { x = 12.0 ; y = 67.0 ; z = 34.0 } } # a translation transfo. applied to sphere
wall: { type = "rotate" ; vector: { x = 0.0 ; y = 0.0 ; z = 45.0 } } # a rotation transfo. applied to wall
}
All transformations applied to primitives are defined in this section.
The transformation's settings are:
name: Target primitive name (name of the section. Examplesphere)type: Transformation type (rotateortranslate)vector: Transformation vector
NOTE: Modifying the config file during execution will automatically update the scene rendering.
The GUI is enabled with the -g / --gui flags.
This GUI enables to modify several parameters at run-time like FOV, number of samples or camera focus point.
The Fast Render button displays the scene render, without light calculations to have a preview of the scene.
This project was developed as part of our second year at EPITECH.
It is forbidden for EPITECH students to use this code. Any attempt to render this code will be considered as cheating, and mark will be -42.




