IBLBaker
Light probe generation and BRDF authoring for physically based shading.
Install / Use
/learn @derkreature/IBLBakerREADME
IBLBaker



About
IBLBaker is provided under the MIT License(MIT) Copyright(c) 2015 Matt Davidson. Please see the LICENSE file for full details.
Feel free to contact me with questions, corrections or ideas. https://github.com/derkreature/ http://www.derkreature.com/
This project makes heavy use of subprojects. Downloading the .zip from github is an insufficient method for acquiring the source for all dependencies. Please checkout the repository through git in order to acquire all required dependencies.
Building
1.) Run "IblBaker.bat" in the source root directory. This will run CMake and automatically setup all dependencies.
IblBaker.bat automatically configures for Visual Studio 2015 x64 and builds with the community edition.
You should not need to change any of the CMake config options.
2.) The output of IblBaker.bat is "Build64" in the root directory.
3.) Open Build64/IblBaker.sln
4.) Set startup project to IBLBaker. There is no elegant way to do this in CMake.
5.) Build and run.
What on earth is this?
The IBLBaker grew out of a quick implementation of the Siggraph Unreal presentations on Physically Based Rendering that I put together for a presentation on OpenSubDiv during late 2013.
The main reason that it is here is to provide a concise example of all the parts required to realtime evaluate light probes for physically based rendering.
While this is not a complete implementation of the required rendering pipeline (I have omitted cavity, bloom, reflection occlusion and realtime ambient occlusion and IBL shadowing (Kreature does these, but I felt that they detracted from the core exercise), it should serve anyone looking to implement dynamic probes in good stead. (If it doesn't, email me, and I will rectify the problem).
At the very least it can be used for baking diffuse irradiance and specular pre-convolved environment cubemaps evaluated over roughness over mips computed using a user specified brdf.
Still Reading?
The baker uses importance sampling to evaluate the environment maps and visualize the results using the separable method proposed by Epic Games at Siggraph 2013.
The tool allows the user to save the computed environment maps and the BRDF Lut to disk for use in other pipelines.
I have provided example cgfx shaders for maya viewport 2.0 in the /maya directory with 2 example scenes in .ma format.
Please review the example maya workflow video at: https://vimeo.com/110805546
The full purpose of this tool can be found in the following videos: https://vimeo.com/100285383 https://vimeo.com/96235208
A Special thanks must be given to Munkyfun (www.munkyfun.com) who sponsored much of the work in preparing this work for an open source release. Thank you so very much guys!
Thank you also to www.gametextures.com for allowing the use and publication of their "Brown Brick" PBR texture set. I will be releasing this set along with a revised shader ball in the near future.
Codebase notes:
I'm not a huge fan of git subprojects, and I'm also not a fan of having to track down all of the dependencies for a project in order for it to build. I recently reenabled AssImp and FreeImage in the default build. For these reasons the repository has grown by a couple of hundred mb.
This codebase is based on an old version (circa 2009) of my personal research framework. It was developed more as an exercise to learn new techniques, so parts of it are fundamentally flawed. One particular area is the use of abstract base types for render API abstraction. This is clearly a bad idea, and will go away before I release. Mainly, I don't want anyone to ever think that this is a good idea.
If a class has an "I" in front of it, or D3D11 at the end, please hold your nose and ignore for the moment :).
I am holding off on pulling from my current framework(Kreature) until I have implemented Vulkan.
Suggested prior reading:
http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
http://seblagarde.wordpress.com/2011/08/17/hello-world/
http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
http://blog.selfshadow.com/publications/s2013-shading-course/pixar/s2013_pbs_pixar_notes.pdf
http://blog.selfshadow.com/publications/s2013-shading-course/hoffman/s2013_pbs_physics_math_notes.pdf
http://blog.selfshadow.com/publications/s2012-shading-course/gotanda/s2012_pbs_beyond_blinn_slides_v3.pdf
http://www.pbrt.org/
Similar projects
- CubeMapGen - A well known tool for cubemap filtering from AMD.<br >
- CmftStudio - A similar open-source project.
- Marmoset Skyshop - Commercial plugin for Unity3D Game engine.
- Knald Lys - Commercial tool from KnaldTech.
Known Leaks:
- D3D11Effects has some serious issues. I will be replacing this in the near future in any case. (Post D3D12/Vulkan in Kreature).
- Shutdown leaks abound after the latest GUI port. I've been in a bit of a hurry, so, uhhh, please forgive.
- AssImp is leaky.
What about linux / osx / iris / bsd / ios / nextstep / rasberry pi / abacus support?
The rendering layer is platform agnostic in principle. For the moment only the D3D11 layer has been implemented. The application layer started out with the best intentions of being agnostic. It unfortunately now requires some work to port from Windows to other platforms. I am working on an OpenGL 4.0 implementation for OSX and Linux at the moment.
How do you use it?
The application config file is an xml document that can be found in: data/iblBakerConfig.xml
Upon starting you should see a pistol surrounded by the input probe environment mapped to sphere.
Controls:
Mouse move will orbit the camera.
Left Control key down + mouse move will rotate the visualized object.
W and S keys zoom the camera in and out from the origin.
Mouse scroll zooms the camera in and out from the origin.
Buttons
"Load Environment" Button New maps can be set by click on the "Import Environment" button. Valid input environments are .dds by default. It is probably better that they are setup as RGBA16F or RGBA32F. Maps can be Lat / Long / equirectangular and cubemap layouts.
While only the DDS codec is enabled by default, it is possible to enable the FreeImage code by adding a project define "#if IBL_USE_ASS_IMP_AND_FREEIMAGE = 1". You will have to provide your own builds of FreeImage and AssImp. The reference codec based on Ogre is in src/codecs/IBLFreeImage.cpp/IBLFreeImage.h. Prior warning if you are building static libraries, both AssImp and FreeImage depend on Zlib.
LDR inputs will also work, however, will not light well. Additional sample environment maps are available in IBLBaker/data/sampleMaps/
Environments can be saved by clicking on the "Save Environment" button. You must specify a .dds filename to export to. A number of files will be saved using the specified .dds filename. I recommend installing the nvidia photoshop dds plugin to view the mips of the saved cube maps.
"Compute" Button The compute button forces invalidation of the IBLProbe and causes the probe to be resampled.
"Cancel" Button The cancel button forces the IBLProbe to be marked valid and no further computation will take place until either a dependency to the probe is altered or "Compute" is clicked on.
Tweak Parameters
Exposure: Exposure parameters for tone mapping.
Gamma: Output gamma for color correction.
Input Gamma: The color space of the input environment map. 1.0 for linear.
Debug Visualization:
No Debug: Renders the object lit. Normal: World space normals. Ambient Occlusion: The blue channel from the RMAOC specular map that contains the ambient occlusion. Albedo: The albedo map for the object. IBL Diffuse: The diffuse irradiance contribution from the environment. IBL Specular: The environment map value sample using reflection vector and the mip layer using the roughness value in the specular map. Metal: The green channel from the RMAOC specular map. Roughness: The red channel from the RMAOC specular map. BRDF: The computed bias/scale terms from the BRDF Lut using ndotv and roughness.
Specular Workflow: Inverts roughness and/or metalness terms for the visualized object.
Specular Intensity:A multiplier to the material specular term for the visualized object.
Roughness Gloss Scale: An inverse multiplier to the roughness term for the visualized object.
BRDF: The brdf that is current being used to evaluate the IBLProbe and render the object. BRDFs can be found in data/shadersD3D11 in .brdf files. These files are hlsl that are concatenated with the core shaders IblImportanceSamplingDiffuse.hlsl, IblImportanceSamplingSpecular.hlsl and IblBrdf.hlsl. You can create new .brdf files to experiment. .brdf files are loaded on application startup and are enumerated automatically.
The generated BRDF lut is displayed in the top right hand corner of the applciation
You may edit shaders while the application is running and they will be automatically reloaded. There is no runtime guard around shader failure. If you write an invalid shader the application will crash. Failures are written data/ShadersD3D11/ShaderFailures wi
