Skip to content

AAstroPhysiCS/PathTracer

Repository files navigation

GPU-based OpenGL Path Tracer

This repository contains a GPU-based path tracer implemented using OpenGL 4.6 compute shaders.

Bistro

The project was developed as part of a university graphics course. The primary motivation was to implement path tracing on older GPUs without dedicated ray tracing cores. Given that OpenGL does not provide native GPU-accelerated ray tracing, this project demonstrates a fully shader-based approach. The renderer evaluates the rendering equation stochastically and progressively converges to physically plausible images through frame accumulation.

Included in this repository are several models located at:

PathTracer/PathTracerEditor/Assets/Models

You can experiment with these models or create your own scenes. (See the screenshots for some examples)

  • Physically Based Path Tracing
    • GGX Microfacet BRDF with Smith shadowing-masking
    • Metallic–roughness workflow (glTF-style)
    • Energy-conserving diffuse and specular shading
    • Bindless texture support (GL_ARB_bindless_texture) for zero-overhead material sampling
    • Multiple Importance Sampling (MIS)
  • Samplers
    • Cosine-weighted hemisphere sampling for diffuse lobes
    • VNDF (Visible Normal Distribution Function) sampling for specular lobes
  • Direct Lighting
    • Directional light (sun) with Next Event Estimation
    • Shadow ray visibility testing
  • Environment Lighting
    • Simple gradient-based sky model
  • Bounding Volume Hierarchy (BVH) using Binning
    • CPU-side generation
    • GPU-side traversal

Building the Project

First of all, these requirements must be fullfilled in order to run this PathTracer.

  • VS 2022 or 2026
  • GPU with support for OpenGL 4.6
  • Support for:
    • GL_ARB_bindless_texture
    • GL_NV_gpu_shader5 (or equivalent functionality)

Since this project already contains all the external dependencies, you can build it via Windows subsystems with Premake by running the Script Generate.bat.

git clone --recursive https://github.com/AAstroPhysiCS/PathTracer.git
cd PathTracer
./Generate.bat

Future Improvements

Screenshots

Bistro
Bistro
Salle de Bain
Salle de Bain
Sponza Atrium
Sponza Atrium

References

  1. Pharr, M., Jakob, W., & Humphreys, G. (2024).
    Physically Based Rendering: From Theory to Implementation (4rd ed.).
    Morgan Kaufmann.

  2. Walter, B., Marschner, S. R., Li, H., & Torrance, K. E. (2007).
    Microfacet Models for Refraction through Rough Surfaces.
    Proceedings of the Eurographics Symposium on Rendering.

  3. Heitz, E. (2014).
    Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs.
    Journal of Computer Graphics Techniques (JCGT), 3(2).

  4. Heitz, E. (2018).
    Sampling the GGX Distribution of Visible Normals.
    Journal of Computer Graphics Techniques (JCGT), 7(4).

  5. Veach, E., & Guibas, L. J. (1995).
    Optimally Combining Sampling Techniques for Monte Carlo Rendering.
    Proceedings of SIGGRAPH 1995.

  6. Narkowicz, K. (2015).
    ACES Filmic Tone Mapping Curve.
    Self Shadow Blog.

  7. Reed, J. (2016).
    Hash Functions for GPU Rendering.
    Reedbeta Blog.

  8. Auziaffe, M. (2024).
    VNDF Importance Sampling for Isotropic GGX Distributions.
    Technical Blog Article.

About

A GPU-based OpenGL Path Tracer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published