Skip to content

`pbrlab` is well-verified(through brute force human verification and debugging) path tracing + PBR shading/rendering implementation.

License

Notifications You must be signed in to change notification settings

lighttransport/pbrlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PBR lab

pbr-sss

pbr-sss-and-hair

pbrlab-hair.mp4

pbrlab is well-verified(through brute force human verification and debugging) path tracing + PBR shading/rendering implementation in portable C++11.

pbrlab is good for verifying your renderer and PBR shading.

Features

Requirements

  • cmake
  • C++11 or later compiler
    • We recommend to use clang++ since g++ is slow to compile embree-portable
  • Embree
    • embree-portable is added as git submodule.
  • OpenGL 3.x
    • For GUI. CLI build is also available.

Supported platform

  • Linux
    • x64_64
    • aarch64
  • Windows 10 64bit
  • arm64 macOS
    • x86 macOS may compile.

Install Dependencies

Ubuntu

Install clang recommended. Install OpenGL dev package(+ X11) required if you want to build GUI.

$ sudo apt install clang cmake
$ sudo apt install libgl1-mesa-dev libglu1-mesa-dev
$ sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev

Optional

$ sudo apt install ccache

Setup

Checkout submodules

$ git submodule update --init --recursive

Building

Visual Studio(2022)

> vcsetup-2022.bat

Or if you using bash(e.g. from Git for Windows)

$ cmd //c vcsetup-2022.bat

Then open solution file at build folder.

VS2019 may work(please modify generator settings in vcsetup-2022.bat)

Linux

$ ./scripts/bootstrap-linux.sh
$ cd cmake-build-relwithdebinfo
$ make

macOS

$ ./scripts/bootstrap-macos.sh
$ cd cmake-build-relwithdebinfo
$ make

Manual cmake invoking(e.g. vscode)

Standard cmake build procedure should work. for exmaple:

$ mkdir build
$ cmake -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo

For ARM target, add -DEMBREE_ARM=1 cmake option recommended(otherwise SSE/AVX compile flags are used)

TODO: provide CMakePresets.json

Built with external Embree(e.g. prebuilt Embree package).

TBB is required to build. (you can install tbb through sudo apt install libtbb-dev on Ubuntu)

Please set the following cmake option. (See an example bootstrap script in scripts/bootstrap-linux-aarch64.sh )

-DPBRLAB_USE_EXTERNAL_EMBREE=On \
-Dembree_DIR=external/embree-4.0.x86_64.linux/lib/cmake/embree-4.0

embree_DIR points to a folder containing embree-config.cmake

Optionally, set path to TBB package if required.

How to run

Run demo scene.

$ pbrlab data/cornellbox_suzanne_lucy.obj

Surface mesh only.

$ pbrtlab input.obj

Hair only(cyhair format. Download here http://www.cemyuksel.com/research/hairmodels/).

$ pbrtlab input.hair

Mesh and Hair.

$ pbrtlab input.obj input.hair

(No xform/scene graph support at the moment)

Model a scene.

Currently pbrlab supports wavefront .obj + .mtl with PBR + SSS extension

https://benhouston3d.com/blog/extended-wavefront-obj-mtl-for-pbr/

or please take a look at tinyobjloader's note: https://github.com/tinyobjloader/tinyobjloader/blob/release/pbr-mtl.md

SSS extension is pbrlab specific.

SSS parameter in Wavefront .mtl

Please see src/material-param.h and AutodeskStandardSurface

https://autodesk.github.io/standard-surface/#closures/subsurfacescattering

for details.

param name value description
subsurface float Subsurface weight
subsurface_radius RGB Subsurface radius(dmfp)
subsurface_color RGB Subsurface color

subsurface_scale is not supported(Please premultiply it to subsurface_radius) subsurface_anisotropy is not supported yet.

TODO

  • NanoRT only ray tracing.
  • More detailed description of Shader/Material parameter.
  • Log
    • nanolog
  • Interactive GUI
    • Draw rendering
    • ImGui UI
  • Curve Mesh
    • CyHair loader
    • xpd loader
  • Cycles's Principled Bsdf
    • Lambert
    • Principled diffuse
    • Subsurface
      • Diffusion model
      • Random walk SSS
        • Henyey Greenstein
        • single instance intersect
    • Microfacet
      • reflection
      • clearcoat
      • refraction
    • sheen
  • Arnold Standard Shader
  • Principled Hair Bsdf
  • Support render config file
  • Scene file
    • json(W.I.P)
    • obj
    • gltf
    • USD
  • Texture
    • jpg, png
    • OpenEXR
  • Light
    • Area light
    • Point light
    • Directional light
    • IBL
  • Camera
    • Pinhole camera
    • Thin lens camera
    • realistic camera
  • GPU acceleration
    • OptiX
    • HIP RT
    • Vulkan RT

FIXME(Need further investigation)

  • Random walk SSS
    • Slightly darker result compared to Cycles' results
  • Clearcoat -> Clearcoat component is too small

License

pbrlab is licensed under MIT license.

The following files are derived from these;

  • src/closure/microface-ggx.h: Open Shading Language (3-clause BSD license)
  • Principled BSDF, Principled Hair BSDF. Based on Cycles' code. Apache 2.0 license.

Third party license

  • TinyObjLoader : MIT license.
  • TinyEXR : BSD license.
  • imgui : MIT license.
  • ImGuizmo : MIT license.
  • stb_image, stb_image_write, stb_image_resize : Public domain
  • glfw3 : zlib/libpng license.
  • glad : unlicense?
  • ionicons : MIT license.
  • Roboto font : Apache 2.0 license.
  • toml11 : MIT license.
  • rapidjson : MIT license.
  • StaticJSON : MIT license.
  • ghc filesystem : BSD-3 license.
  • mpark variant : BSD-1 license.
  • Embree : Apache-2.0
  • pcg-random : Apache-2.0
  • pbrt : BSD-2 license.
  • Cycles : Apache 2.0 license
  • OpenShadingLanguage : BSD-3 license.
  • OpenImageIO : BSD-3 license
  • miniz: MIT license. https://github.com/richgel999/miniz

About

`pbrlab` is well-verified(through brute force human verification and debugging) path tracing + PBR shading/rendering implementation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published