PBR shader

Physically based shader written in HLSL.

2015

Introduction

I created this shader to get a deeper understanding for how physically based rendering works.

Character model created by Joachim Häggström.

Features

  • Written in HLSL
  • Directional lights utilizing GGX distribution
  • Image-based lighting
  • Metallic/roughness workflow
  • Allows for overlapping and mirrored normal maps

Problems encountered

I used ShaderTool to pipe all the data into the shader. While this allowed me to create the shader in a short time span, it also came with a few drawbacks, such as no support for HDR cubemaps and the fact that mipmaps are recomputed for DDS textures when they are loaded. This stopped me from using HDR cubemaps and pre-convolved GGX cubemaps that are synced between the authoring program (Knald Lys) and the shader.