Skip to content

matmont/raytracy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ray Tracer (University Project)

This repository contains a small ray tracing project with three implementations of the same renderer:

  • a sequential CPU version
  • a FastFlow parallel CPU version
  • a CUDA GPU version

The goal is to keep the rendering pipeline and scene logic comparable across implementations, so performance and scaling behavior can be evaluated more clearly.

Sample Output

Rendered image (from seq.ppm):

Sequential render

Project Layout

  • main.cpp: sequential entry point
  • raytracer_ff/main_ff.cpp: FastFlow entry point
  • raytracer_cuda/main.cu: CUDA entry point
  • materials/: material models
  • report/: performance and analysis artifacts
  • scripts/: helper scripts for experiments

How to Launch

Assuming cwd the outer one (i.e., ray_tracer_final/) and the FastFlow library located at ../fastflow. To open .ppm files on Linux: eog img.ppm (ensure that WRITE_IMG macro is set to true).

Sequential

g++ -O3 main.cpp -o main.out
./main.out > seq.ppm

Macros:

  • WRITE_IMG
  • IMAGE_WIDTH
  • SAMPLES_PER_PIXEL
  • MAX_BOUNCING_DEPTH

The scene can be changed in main.cpp. Image sample is ./seq.ppm.

FastFlow

g++ -O3 -I ../../fastflow raytracer_ff/main_ff.cpp -o raytracer_ff/main_ff.out
./raytracer_ff/main_ff.out > ff.ppm

Macros:

  • WRITE_IMG
  • IMAGE_WIDTH
  • SAMPLES_PER_PIXEL
  • MAX_BOUNCING_DEPTH
  • NUM_WORKERS
  • FF_ROW_BLOCK: grain parameter of ParallelFor

The scene can be changed in raytracer_ff/main_ff.cpp. Image sample is ./ff.ppm.

Cuda

nvcc raytracer_cuda/main.cu -o raytracer_cuda/main_cu.out
./raytracer_cuda/main_cu.out > cuda.ppm

Macros:

  • WRITE_IMG
  • MEMORY_UNIFIED: 1 to use unified memory, 0 to use explicit memory
  • IMAGE_WIDTH
  • ASPECT_RATIO
  • MAX_DEPTH_RT: same as MAX_BOUNCING_DEPTH
  • SAMPLING_SIZE: same as SAMPLES_PER_PIXEL

The scene can be changed in raytracer_cuda/ray_tracing.cu. Image sample is ./cuda.ppm.

About

📹 Sequential and Parallel implementations of a (Toy) Ray Tracer.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors