BRDF LUT generation for PBR Pipelines

Overview

BRDF Generator

This is a simple program that generates Smith GGX BRDF lookup tables for the split sum approximation of the UE4-based PBR pipeline. These lookup tables are stored in KTX or DDS texture. The program generates two channel(RG) images using either 16 bit or 32 bit floating point precision.

Note: It is important to use a floating point image to prevent clamping of values in your PBR pipeline.  
For most applications 16 bits is sufficient.  

Since this table is used for an approximation, some errors are introduced into the final renderings. The top image shows the reference path traced rendering, the middle shows a split sum approximation and the bottom shows the full approximation where N=V.

When loading the texture into OpenGL, use the following filters to ensure that values are read correctly.

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

More Reading:

Usage

BRDFGenerator -f [filename] -s [size] -n [samples] -b [bits]

Options:

-f [filename] The location and filename of the output image.  Must have an extension of ktx or dds.
-s [size] The size of the image in pixels per side. i.e. 512 will generate a 512x512 image. 
-n [samples] The number of BRDF samples per pixel. 
-b [bits]  The number of floating point bits used to store the data.  Can be either 16 or 32.

Algorithm

For each pixel (x, y):
   Compute roughness (0 to 1.0) based on pixel x coordinate.
   Compute NoV (0 to 1.0) based on pixel y coordinate.
   Set view as float3(sqrt(1.0 - NoV * NoV), 0, NoV).
   Set normal as float3(0, 0, 1). 
   For each sample:
        Compute a Hammersely coordinate.
        Integrate number of importance samples for (roughness and NoV).
        Compute reflection vector L
        Compute NoL (normal dot light)
        Compute NoH (normal dot half)
        Compute VoH (view dot half)
        
        If NoL > 0
          Compute the geometry term for the BRDF given roughness squared, NoV, NoL
          Compute the visibility term given G, VoH, NoH, NoV, NoL
          Compute the fresnel term given VoH.
          Sum the result given fresnel, geoemtry, visibility.
   Average result over number of samples.

Built With

The project has two header based dependencies, GLI and GLM, they are currently stored in the ext folder.

  • GLM - Math Functions
  • GLI - Image Saving

License

This project is licensed under the MIT License - see the LICENSE file for details

You might also like...
New generation entropy codecs : Finite State Entropy and Huff0

New Generation Entropy coders This library proposes two high speed entropy coders : Huff0, a Huffman codec designed for modern CPU, featuring OoO (Out

zlib replacement with optimizations for "next generation" systems.

zlib-ng zlib data compression library for the next generation systems Maintained by Hans Kristian Rosbach aka Dead2 (zlib-ng àt circlestorm dót org) C

A collection of single-file C libraries. (generic containers, random number generation, argument parsing and other functionalities)

cauldron A collection of single-file C libraries and tools with the goal to be portable and modifiable. Libraries library description arena-allocator.

zlib replacement with optimizations for "next generation" systems.

zlib-ng zlib data compression library for the next generation systems Maintained by Hans Kristian Rosbach aka Dead2 (zlib-ng àt circlestorm dót org) C

Advanced, modular, coupled geomorpohology simulator for real-time procedural terrain generation.
Advanced, modular, coupled geomorpohology simulator for real-time procedural terrain generation.

SoilMachine Advanced, modular, coupled geomorpohology simulator for real-time procedural terrain generation in C++. Visualization with TinyEngine. Art

Stack-based texture generation tool written in C99!
Stack-based texture generation tool written in C99!

Stack-based texture generation tool written in C99! Brought to you by @zaklaus and contributors Introduction zpl.texed is a cross-platform stack-based

LightSeq: A High Performance Library for Sequence Processing and Generation
LightSeq: A High Performance Library for Sequence Processing and Generation

LightSeq is a high performance training and inference library for sequence processing and generation implemented in CUDA. It enables highly efficient computation of modern NLP models such as BERT, GPT, Transformer, etc. It is therefore best useful for Machine Translation, Text Generation, Dialog, Language Modelling, Sentiment Analysis, and other related tasks with sequence data.

This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX
This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX

Apress Source Code This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX by Adam Marrs, Peter Shirley

FluidNC - The next generation of motion control firmware
FluidNC - The next generation of motion control firmware

FluidNC (CNC Controller) For ESP32 Introduction FluidNC is the next generation of Grbl_ESP32. It has a lot of improvements over Grbl_ESP32 as listed b

easy to use, powerful & expressive command line argument parsing for modern C++ / single header / usage & doc generation

clipp - command line interfaces for modern C++ Easy to use, powerful and expressive command line argument handling for C++11/14/17 contained in a sing

A next generation media player, with vim-like bindings

MusicKid A next generation media player, with vim-like bindings Installation Clone the repo git clone git-url cd MusicKid/Final Install dependencies

3D Procedural Terrain Generation Tool in OpenGL/C++
3D Procedural Terrain Generation Tool in OpenGL/C++

TerraGen3D 3D Procedural Terrain Generation Tool in OpenGL/C++ Give your valuable feedback : https://github.com/Jaysmito101/TerraGen3D/discussions/6 T

🎻 Automatic Exploit Generation using symbolic execution

S2E Library This repository contains all the necessary components to build libs2e.so. This shared library is preloaded in QEMU to enable symbolic exec

The offical repository of the nextbird browser (for the 13th Generation)
The offical repository of the nextbird browser (for the 13th Generation)

The Nextbird Browser Introduction for Nextbird Was ist Nextbird? Nextbird is ein open source Browser der sich zum Ziel gesetzt hat denn Firefox Browse

Code generation for automatic differentiation with GPU support.

Code generation for automatic differentiation with GPU support.

New generation message broker service
New generation message broker service

Push1st Push1st is open source multiple protocol PUB/SUB message broker server (Pusher, MQTT, RAW WebSocket). Key features Suitable for distributed on

3D Procedural Terrain Generation and Texturing Tool in OpenGL/C++
3D Procedural Terrain Generation and Texturing Tool in OpenGL/C++

TerraForge3D 3D Procedural Terrain Generation Tool in OpenGL/C++ Give your valuable feedback : https://github.com/Jaysmito101/TerraForge3D/discussions

The ESP-BOX is a new generation AIoT development platform released by Espressif Systems.

中文版本 ESP-BOX AIoT Development Framework Important Note: We recommend updating the ESP32-S3-BOX firmware when you first receive the product to have the

A command line and keyboard based strategy-game written in c++, where audio-input determines the AI-strategy and lays the seed for the map-generation.
A command line and keyboard based strategy-game written in c++, where audio-input determines the AI-strategy and lays the seed for the map-generation.

Table of contents Dissonance Premise Installation Requirements Installation Quick-guide Detailed installation guide Usage Logfiles Tests Uninstall Kno

Releases(1.0)
  • 1.0(Nov 6, 2017)

    Simple program that generates BRDF lookup tables for the split sum approximation of UE4-based PBR. Usage: BRDFGenerator -f [filename] -s [size] -n [samples] -b [bits]

    Options:

    • -f [filename] The location and filename of the output image. Must have an extension of ktx or dds.
    • -s [size] The size of the image in pixels per side. i.e. 512 will generate a 512x512 image.
    • -n [samples] The number of BRDF samples per pixel.
    • -b [bits] The number of floating point bits used to store the data. Can be either 16 or 32.

    More Reading:

    http://gamedevs.org/uploads/real-shading-in-unreal-engine-4.pdf

    https://learnopengl.com/#!PBR/IBL/Specular-IBL

    Source code(tar.gz)
    Source code(zip)
    BRDFGenerator.exe(110.00 KB)
Owner
Hector Medina-Fetterman
Researcher at Ohio State University. Interested in game development, computer graphics, and light transport.
Hector Medina-Fetterman
3D Procedural Terrain Generation Tool in OpenGL/C++

TerraGen3D 3D Procedural Terrain Generation Tool in OpenGL/C++ Give your valuable feedback : https://github.com/Jaysmito101/TerraGen3D/discussions/6 T

Jaysmito Mukherjee 676 Dec 21, 2022
Light probe generation and BRDF authoring for physically based shading.

IBLBaker About IBLBaker is provided under the MIT License(MIT) Copyright(c) 2015 Matt Davidson. Please see the LICENSE file for full details. Feel fre

MattD 660 Dec 28, 2022
pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material.

pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material. The tool is detecting depending on the filename, which PBR information is stored. It swizzles the images and does reassign the channels to a glTF 2.0 image. The tool stores the images plus a minimal, valid glTF 2.0 file containing the required material, textures and images.

UX3D GmbH 23 Jul 31, 2022
CNStream is a streaming framework for building Cambricon machine learning pipelines

CNStream is a streaming framework for building Cambricon machine learning pipelines

Cambricon Technologies 13 Dec 30, 2022
Tuplex is a parallel big data processing framework that runs data science pipelines written in Python at the speed of compiled code

Tuplex is a parallel big data processing framework that runs data science pipelines written in Python at the speed of compiled code. Tuplex has similar Python APIs to Apache Spark or Dask, but rather than invoking the Python interpreter, Tuplex generates optimized LLVM bytecode for the given pipeline and input data set.

Tuplex 791 Jan 4, 2023
A simple and easy-to-use library to build pipelines in C

A simple and easy-to-use library to build pipelines in C

Ray 15 Dec 25, 2022
TengineGst is a streaming media analytics framework, based on GStreamer multimedia framework, for creating varied complex media analytics pipelines.

TengineGst is a streaming media analytics framework, based on GStreamer multimedia framework, for creating varied complex media analytics pipelines. It ensures pipeline interoperability and provides optimized media, and inference operations using Tengine Toolkit Inference Engine backend, across varied architecture - CPU, iGPU and VPU.

OAID 69 Dec 17, 2022
New generation entropy codecs : Finite State Entropy and Huff0

New Generation Entropy coders This library proposes two high speed entropy coders : Huff0, a Huffman codec designed for modern CPU, featuring OoO (Out

Yann Collet 1.1k Dec 29, 2022
zlib replacement with optimizations for "next generation" systems.

zlib-ng zlib data compression library for the next generation systems Maintained by Hans Kristian Rosbach aka Dead2 (zlib-ng àt circlestorm dót org) C

zlib-ng 13 Dec 29, 2022
nanomsg-next-generation -- light-weight brokerless messaging

nng - nanomsg-next-gen ℹ️ If you are looking for the legacy version of nanomsg, please see the nanomsg repository. This project is a rewrite of the Sc

nanomsg 3k Dec 30, 2022