Skip to content

cuRT is a GPU-accelerated ray tracer written in CUDA and OpenGL.

Notifications You must be signed in to change notification settings

krishi-saripalli/cuRT

Repository files navigation

cuRT

cuRT is a GPU-accelerated ray tracer written in CUDA and OpenGL.

System Requirements

  • NVIDIA GPU with compute capability 8.6 or higher
  • CUDA Toolkit
  • CMake 3.16 or higher
  • C++20 compatible compiler
  • GLEW 2.2.0
  • GLFW 3.4
  • OpenGL
  • OpenMP
  • X11 (optional if working on a remote Linux machine)

Getting Started

  1. Clone the repository and initialize submodules:
cd raymarcher
git submodule update --init --recursive  # Required for Eigen dependency
  1. Configure CUDA Architecture:
  1. GLEW Configuration:
  • Current paths are hardcoded for a specific system. Update these paths to match your GLEW installation:
set(GLEW_INCLUDE_DIR "path/to/your/glew/include")
set(GLEW_LIBRARY "path/to/your/glew/lib64/libGLEW.so")
  • Also update the CMAKE_INSTALL_RPATH if needed
  1. Build the project:
mkdir build
cd build
cmake ..
make

Running cuRT

The program takes a config file (which can be edited to change the scene and image dimension) as input and must be run with an absolute path:

./raymarcher /absolute/path/to/your/config.json`

Scene File Format

cuRT uses a JSON format developed by Brown's CS1230 course staff to define the 3D environment. Below is a detailed breakdown of the format:

The root object must contain:

  • name: String identifier for the scene
  • globalData: Global lighting coefficients
  • cameraData: Camera setup and position
  • groups: Array of scene objects and lights

Global Data

Controls scene-wide lighting parameters:

"globalData": {
   "ambientCoeff": 0.5,    // Ambient light intensity (0-1)
   "diffuseCoeff": 0.5,    // Diffuse reflection intensity (0-1)
   "specularCoeff": 0.5,   // Specular reflection intensity (0-1)
   "transparentCoeff": 0   // Transparency amount (0-1)
}

Camera Data

"cameraData": {
    "position": [-6.0, 4.0, 4.0],  // Camera position [x, y, z]
    "up": [0.0, 1.0, 0.0],         // Up vector [x, y, z]
    "focus": [0, 0, 0],            // Look-at point [x, y, z]
    "heightAngle": 30.0            // Vertical field of view in degrees
}

Light Data

Currently supports point, spot and directional lights

{
    "type": "point",
    "color": [r, g, b],               // RGB values (0-1)
    "attenuationCoeff": [a, b, c]     // Attenuation factors (constant, linear, quadratic)
}

Primitive Data

Support for sphere, cube, cone and cylinder primitives. Meshes are in progress

{
    "type": "sphere",              // or "cube", "cylinder", "cone"
    "diffuse": [r, g, b],         // RGB diffuse color (0-1)
    "specular": [r, g, b],        // Optional: RGB specular color (0-1)
    "shininess": 15.0             // Optional: Specular shininess
}

Known Issues and Limitations

  • GLEW paths are currently hardcoded and need to be manually updated
  • Compute capability is set to 8.6 by default
  • Only tested on Linux systems with X11
  • Requires absolute paths for scene files

Development Notes

  • Built with C++20
  • Uses CUDA separable compilation
  • OpenMP is enabled for CPU parallel processing
  • Includes debug flags for CUDA (-G -g)

TODOs

  • Support Triangle Meshes
  • Remove main render kernel in favor of a wavefront approach based on this paper
  • Add BVH support

About

cuRT is a GPU-accelerated ray tracer written in CUDA and OpenGL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages