Skip to content

Raytracer in C. Optimized with OpenACC for CIS 5640

Notifications You must be signed in to change notification settings

rocketmax/openacc_raytracer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a class project for CIS 5640 at Oakland University. The goal was to take an available code base that had a high computational load and runtime that could be optimized by adding parallelization with OpenACC.

Dependencies

Build

The original raytracer project from kgabis offered two different rendering mechanisms. For simplicity, we use the libpng option. To build without OpenACC, use make. To build the OpenACC implementation, use make_acc

Usage

There are three different scenes available, spheres, snowman, and teapot. Teapot is the most computationally intensive as it uses a mesh texture instead of spheres. This makes it a good target for benchmarking the OpenACC implementation. To run, the binary without OpenACC is raytracer and the one with is raytracer_acc. For example, to run the two to time them against each other, the commands could be ./raytracer teapot ./raytracer_acc teapot

Files

  • array
    • Defines a dynamically allocated array struct implementation
  • camera
    • Sets up a simulated camera to trace rays from
  • color
    • Struct of a three channel color (RGB) with helper functions
  • csfml_render
    • Unused in our project
  • geometry
    • Structs for the spheres and triangles used for 3D objects in the scene
  • light
    • Defines light sources and helper functions for the scene
  • main
    • Sets resolution and starts the raytracer
  • material
    • Struct for material characteristics (color, reflectivity, noise, specularity)
  • mesh
    • Helper functions to load triangles from a file into an array that defines a 3D object
  • png_render
    • Draws pixels into an output PNG file
  • ray
    • Defines rays with an origin and direction and provides functions to perform the tracing of the ray
  • raytracer
    • Initializes rays, traces the rays, and draws the defined color for each pixel.
  • scene
    • Struct that contains surfaces, lights, the camera, etc.
  • surface
    • Struct that includes both spheres and triangles and helps to find normal vector at a point on the surface
  • vector
    • 3D vector implementation and helper functions

Credit

Credit for the bulk of the C code before parallelization goes to Krzysztof Gabis and can be found here: https://github.com/kgabis/raytracer

License

The MIT License (MIT)

About

Raytracer in C. Optimized with OpenACC for CIS 5640

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 94.2%
  • Shell 3.4%
  • Makefile 2.4%