Skip to content

Physically based rendering

Chuck Walbourn edited this page Aug 30, 2021 · 17 revisions

In this lesson we learn the basics of Physically-Based Rendering (PBR) as supported by the DirectX Tool Kit.

What does 'Physically-based' mean?

A full discussion of Physically-Based Rendering (PBR) is beyond the scope of this lesson, so see the references at the end of the page. Instead I'll provide a short motivation of why PBR is useful. The first thing to acknowledge is that traditional computer graphics lighting algorithms are inspired hacks. They work well at providing many useful lighting clues, and have been inexpensive enough to compute on consumer level hardware for decades. These algorithms, however, all have drawbacks. For example, basically anything you render using Phong shading ends up looking like it's made of smooth plastic. Another challenge is that textures, models, and other assets that look great in some lighting conditions and lighting algorithms don't work at all when moved to a new engine or solution which makes it harder to reuse expensive artwork.

The proponents of PBR rendering have gone back to the foundational rendering equation and built new algorithms that in some way better mimic laws of physics (such as the law of conservation of energy). While there are many ways to formulate a PBR materials & lighting system, the industry has converged on a few workflows. DirectX Tool Kit implements the "Disney-style Roughness/Metalness" workflow as it's well-understood, has reasonably good tooling support, and is the one that was chosen for Khronos' glTF2 asset format and many modern game engines.

PBR rendering essentially requires HDR rendering as there's no physical process that clamps light into a 0 to 1 range. As such, be sure you have worked through the Using HDR rendering tutorial before this one.

Image-Based Lighting (IBL)

Another important aspect of PBR is that real world lighting is not well modeled by trivial point, directional, or spot light sources. Area lighting or other global illumination systems are expensive and/or complex to implement in real-time systems, so for the purposes of DirectX Tool Kit's PBR implementation we make of image-based lighting. Specifically the ambient lighting environment consists of two specially formulated cubemaps, in addition to direct lighting from up to 3 directional lights.

PBREffect

UNDER CONSTRUCTION

Rendering a PBR Model

UNDER CONSTRUCTION

More to explore

  • See the SimplePBR12 sample for UWP / Xbox for more details on the shader implementation used by the tool kit.

Next lessons: Game controller input, Using the SimpleMath library, Adding the DirectX Tool Kit for Audio

Further Reading

DirectX Tool Kit docs PBREffect

Physically-Based Rendering wikipedia

Basic Theory of Physically-Based Rendering

Burley et al. "Physically-Based Shading at Disney", SIGGRAPH 2012 Course: Practical Physically Based Shading in Film and Game Production. Slides

SIGGRAPH Course: 2012 2013 2014 2015 2016 2017 2020

Art Pipeline for glTF

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Xbox One
  • Xbox Series X|S

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v18
  • MinGW 12.2, 13.2
  • CMake 3.20

Related Projects

DirectX Tool Kit for DirectX 11

DirectXMesh

DirectXTex

DirectXMath

Tools

Test Suite

Model Viewer

Content Exporter

DxCapsViewer

See also

DirectX Landing Page

Clone this wiki locally