Git Product home page Git Product logo

pathtracer's Introduction

Path Tracer

My personal implementation of a roughly "feature complete" Path Tracer. The beginnings of the codebase were roughly identical to the Path Tracer constructed during the Handmade Ray Day 1 livestream, archived at https://guide.handmadehero.org/ray/ray00/. From then, I programmed the rest "in the dark" (for the most part); i.e., I didn't consult any open source Path Tracer implementations. To guide development, I sourced content from books, which I reference in the References section below. I'm aware that this isn't the ideal approach for writing a Path Tracer as fast as possible; I chose this approach because I was looking for a coding adventure :)

test test_balls test_onewknd testmario cornell

Features

  • Importance sampling Monte Carlo Integration.
    • GGX importance sampling.
    • Emissive sphere importance sampling.
    • Cosine sampling.
  • Materials:
    • Specular BSDF from microfacet theory: GGX distribution function, Smith joint shadow-masking courtesy of Hammon et al., and Slick approximation of Fresnel equations.
    • Uniform diffuse BSDF.
    • Albedo, roughness, metalness, and normal textures.
    • Disney "principled" roughness parameterization.
  • Physical lens model.
  • GLTF import.
  • Supported Geometry: Triangles, Spheres, Planes, AABBs, Quads.
  • Multithreaded architecture.
  • Live viewer.
  • Output .BMP image format.

References

Usage

e.g.: "AutomataApp.exe -t16 -p16 -nmr"

t<int>                        - Set the number of threads to use.
p<int>                        - Set the rays to shoot per pixel.
w<int>                        - Set the world number to load. Possible options:
  1:  Default scene.
  2:  Metal-roughness test.
  3:  Cornell box.
  4:  Ray Tracing in One Weekend book cover.
  5:  Mario N64 model.
    
d                             - Enable depth of field via thin-lens approximation.
n                             - Disable loading normal map textures.
m                             - Disable loading metalness material textures.
r                             - Disable loading roughness material textures.
h                             - Print this help menu.

Steps for Building

This project depends on my game engine, Automata-Engine. You can find that here: https://github.com/BluBloos/Automata-Engine

The engine has its own dependencies, but the TLDR is:

  • this project only works on Windows
  • install Python and make sure its on your PATH
  • install MS Visual Studio 2022, community ed. and ensure it is located at "C:\Program Files"

To build and run the raytracer on the scene, please run the following.

build.bat
bin\AutomataApp.exe

Happy path tracing!

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.