Code Monkey home page Code Monkey logo

path-tracer's Introduction

Path Tracer

This work is in progress.

CUDA / C++ path tracer with bounding volume hierarchy (BVH) based on the tutorial series by jbikker

Pure C++ version for CPU

Test scenes

Scene 0: 3 instances BVH heat map (max 267)
Scene 1: 10,000 instances BVH heat map (max 600)
Scene 2: Model with vertex attributes BVH heat map (max 123)
triangles per mesh BLAS time (s) TLAS total triangles max tests
Scene 0 505,848 792,591 0.88 5 1,517,544 267
Scene 1 505,848 792,591 0.88 19,819 5,058,480,000 600
Scene 2 3,828 4,899 0.0049 1 3,828 123

Performance

  • Resolution: 1500 x 800
  • Samples: 100
  • Max bounces: 6
  • CPU: 13th Gen Intel Core i7-13700H ร— 20
  • GPU: NVIDIA GeForce RTX 3050 6GB

"Bust of Menelaus" by Scan The World

"Viking room" by nigelgoh (edited)

Environment map from HDR Haven

Features

  • BVH (BLAS + TLAS) construction and traversal
  • Cook-Torrance
  • Trowbridge-Reitz (GGX) specular
  • Lambertian diffuse
  • BRDF importance sampling

Use

Running outputs parameters and progress to the console

Resulting image is output as output.bmp

  • make clean (to remove old executable)
  • make build
  • make run (with default settings)
  • make all (clean, build, run)
  • ./PathTracer [options]
    • -d 0: CUDA (default), 1: CPU
    • -w width of rendered image (e.g. -w 512)
    • -h height of rendered image
    • -s samples per pixel
    • -b maximum bounces per ray per sample
    • -t number of threads (ignored when using CUDA)
    • -p preset scene [0, 2]
    • -a output BVH heatmap (ignores -s and -b)

Dependencies

  • GLM for maths functions and data structures
  • stb for reading and writing images (included in /lib)
  • stl_reader for reading STL files (included in /lib)
  • tinyobjloader for loading OBJ files (included in /lib)
  • C++17
  • make (optional)

path-tracer's People

Contributors

al-ro avatar

Stargazers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.