Skip to content
/ crayg Public

Personal raytracer to learn C++ and rendering

Notifications You must be signed in to change notification settings

Latios96/crayg

Repository files navigation

Build Status

Personal Raytracer project started to get familiar with C++ in general and how to do CI and TDD in C++.

demo image

Cornell Box by http://casual-effects.com/data/index.html

Features

Rendering related features

  • Sphere / Trianglemesh intersection
  • PointInstancer (Single-Level Instancing)
  • Area lights (Rect and Disk)
  • perfect reflections
  • diffuse reflections / GI
  • Intel Embree based BVH
  • Adaptive sampling inspired by Dreamwork's Implementation of the paper by Dammertz et al.
  • multiple integrators:
  • Basic support for Subdivision Surfaces using OpenSubdiv
  • Scene format uses USD, with basic respect for UsdRender
  • CLI interface
  • Qt based Renderview GUI

Project features not related to rendering

  • Unittests
  • Integrationtests using Cato
  • Continuous Integration using Github Actions
  • support for Windows, Linux and Mac OS
  • fully automated CMake build
  • Support for CMake Unity builds
  • Dependency Management using Conan
    • Conan Recipes for OpenSubdiv (available in Conan Center) and USD (to be contributed to Conan Center)
  • Autodesk Maya GUI integration for easy authoring of integration test scenes (more details)

Build the project

Prerequisites

  • Conan Package Manager, get it here
  • CMake
  • A C++ 17 compiler
  • (access to my custom USD Conan recipe)

The invocation of Conan is handled transparently by CMake

Build

For better buid speed, it is recommended to do a CMake unity build by specifying -DCMAKE_UNITY_BUILD=true -DCMAKE_UNITY_BUILD_BATCH_SIZE=16

Linux & Mac OS

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=true -DCMAKE_UNITY_BUILD_BATCH_SIZE=16 ..
make -j 4

Windows

mkdir build
cd build
cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=true -DCMAKE_UNITY_BUILD_BATCH_SIZE=16 ..
cmake --build . --config Release -- /M:%NUMBER_OF_PROCESSORS%

Alternatively, you can also use Ninja:

mkdir build
cd build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -G "Ninja" .. -DCMAKE_BUILD_TYPE=Release
ninja

Test execution

cd build
ctest -V

Development Setup

# you may want to use a virtualenv
pip install -r requirements-dev.txt
pre-commit install
git config blame.ignoreRevsFile .git-blame-ignore-revs

Test Integration for Autodesk Maya

Qt / Python based tool for easy authoring of integration test scenes inside of Autodesk Maya

For each test, a Maya .ma file and a .usda file is stored

Prerequisites

Currently, Autodesk Maya 2023 is supported. You need to have the maya-usd installed

Make sure to install the Python dependencies inside Maya:

C:\Program Files\Autodesk\Maya2023\bin\mayapy -m requirements.txt

Launching and Usage

Start Maya with the test integration via command line:

cd src\mayaTestIntegration
start_maya.bat

When Maya is open, a new Shelf is added. Use the Inspector Icon to launch the test integration:

The Test Integration will present you the suites / tests as a tree view

Functions

Open

Opens the .ma file associated with the test

Save

Saves the currently open test as a .ma file and exports scene to .usda

Create a new Suite or Test

Suite: right-click into tree view Test: right-click on a suite