Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 PCAP Raycaster: Real-Time CUDA GPU Ray Tracer

A high-performance, real-time GPU-accelerated ray tracer built using CUDA for kernel computations and rendered via OpenGL / GLUT.


✨ Features

  • GPU Acceleration: Parallelized ray tracing model (one CUDA thread per pixel).
  • Interactive Shading: Phong shading model including ambient, diffuse, specular, and rim lighting.
  • Dynamic Lighting: Control the light direction dynamically using your mouse cursor.
  • Soft Shadows & Reflections: Multi-sampled soft shadows via jittered rays and reflection bounce accumulation up to 5 bounces.
  • Scene Customization:
    • 4 Geometry Types: Independently toggleable Sphere, Box, Cone, and Cylinder.
    • 5 Presets: Cycle presets using standard functions.
  • Live HUD Overlay: Translucent panel displaying real-time FPS telemetry, camera position, and shape toggle states.

🛠️ Prerequisites

Ensure your environment has the following installed:

  • NVIDIA GPU with CUDA support.
  • CUDA Toolkit (>= 11.0) with nvcc available in your system path.
  • OpenGL/GLUT Library:
    sudo apt install freeglut3-dev
  • WSL Users: Make sure an X server (like VcXsrv or WSLg) is active, and your DISPLAY variable is set correctly.

⚙️ Compilation & Build

To compile the primary application and the test suite, run:

make

Adjusting GPU Compute Architecture

If your GPU has a different compute capability, edit the ARCH variable in the Makefile.

To find your GPU capability, build and run the check test:

make test-check && ./test/check

🚀 Running the Project

Run the main compiled binary:

./main

WSL Configuration

If running under WSL without WSLg, ensure you export your display:

export DISPLAY=:0
./main

🎮 Interactive Controls

Control Action
W / S Move camera forward / backward (Z axis)
A / D Move camera left / right (X axis)
Q / E Move camera up / down (Y axis)
Mouse Move Rotate light source dynamically
F1 Toggle Sphere visibility
F2 Toggle Box visibility
F3 Toggle Cone visibility
F4 Toggle Cylinder visibility
F5 Cycle through scene presets
ESC Quit application

📂 Project Structure

├── src/
│   ├── main.cu        # Host orchestration, window setup, display loop, input handlers
│   ├── renderer.cuh   # CUDA raytracing kernels, shading models, shadow/reflection calculations
│   ├── scene.cuh      # Geometry intersection test functions (Sphere, Box, Cone, Cylinder, Triangle)
│   └── hud.cuh        # OpenGL HUD overlay text rendering
├── test/
│   ├── check.cu       # Verifies CUDA environment, prints device name and compute capability
│   ├── math.cu        # Verifies CUDA kernel executions and host-device memory transfers
│   └── rgb.c          # Verifies OpenGL/GLUT drawing canvas functionality
├── Makefile           # Main build configuration file
├── .gitignore         # Build artifacts and ignore configuration
└── README.md          # Project user guide

🧪 Verification Tests

You can test individual system components:

# Verify CUDA Device Detection
make test-check && ./test/check

# Verify CUDA Math Operations
make test-math && ./test/math

# Verify OpenGL Pixel Drawing
make test-rgb && ./test/rgb

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages