Skip to content

lulvz/raysarecul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raysarecul: A Simple Ray Tracer

This project is an attempt at ray tracing, a rendering technique for generating an image by tracing the path of light as pixels in an image plane and simulating the effects of its encounters with virtual objects.

img

File Descriptions

  • src/ray.cpp: This file contains the main logic of the ray tracing process. It sends a ray for every pixel and checks for intersections with the defined objects (spheres and planes). Depending on the intersection results, it sets the color of the pixel.

  • src/td.h: This file contains the definitions of various structures used in the project, such as vectors (Vec3), rays (Ray), spheres (Sphere), planes (Plane), and colors (Color). It also includes the implementation of the dot product operation``

  • optional/equations_sphere_intersection: This file contains the equation used to detect intersections between a ray and a sphere. The equation is a quadratic formula derived from the geometric definition of a sphere.

  • Makefile: This file contains the build`instructions for the project. It compiles src/ray.cpp into an executable named lulz.

  • images/img.ppm: Thi`` is the output image file generated by the ray tracer.

Usage

To use this project, follow these steps:

  1. Clone the repository to your local machine.
  2. Navigate to the project directory in your terminal.
  3. Run the command make to compile the project. This will create an executable named lulz.
  4. Run the executable with the command ./lulz. This will generate an image file named img.ppm in the images directory.

Learning Outcomes

  1. Understanding the concept of rays and how they are used to simulate the path of light in a 3D scene.
  2. Learning how to detect intersections between rays and geometric objects (spheres and planes in this case).
  3. Implementing the dot product operation, a fundamental operation in vector algebra.
  4. Gaining experience with C++ and its features, such as structures and file I/O.
  5. Learning how to use a Makefile to automate the build process of a C++ project.

Disclaimer

This project is kind of old and one of my first times using c/c++, however I still value it as a learning experience since I went into it head on and knew nothing about c/c++ at the time. The end result is really simple but I'm still proud of it. Maybe in the future I will revisit this project and add more features to it.

About

attempt at ray tracing

Resources

License

Stars

Watchers

Forks

Packages

No packages published