The Assets of the PBR Demo

Summary of the assets required by the PBR SDK example

The assets are amongst the most important and interesting parts of this demo. There are a multitude of textures for both the model and the environment which must be processed in order to be used in the demo.

Please see Processing the Assets for details on creating and processing these assets, as well as specific formats and optimisations.

The assets needed for this implementation include:

A model file

This contains all of the information about the model which is going to be rendered, including mesh data and textures. This is usually a GLTF or POD file with some additional texture map files.

The most important thing is that the GLFT or POD file should be expressed in the same way as the demo expects, in this case, a metallic-roughness model rather than PBR specular/shininess or non-PBR diffuse/specular.

The demo uses the Damaged Helmet Khronos GLTF sample.

It contains:

  • all the mesh data:
    • positions
    • normals
    • texture coordinates
    • tangent-space vectors, if supported
  • textures:
    • normal map
    • metallic
    • roughness
    • ambient occlusion
    • albedo values

A simple procedural model (without a GLTF file) of a few spheres is also used in this demo. These spheres are used to demonstrate a gradient of roughnesses for metallic and non-metallic objects of different colours. These do not support normal maps, or material property maps at all, and everything is a fixed value.

Damaged Helmet Sample

Sample of Spheres

A texture with a specular BRDF (bidirectional reflectance distribution function) encoded in it

A BRDF is a function which determines how light reflects off the model based on its material properties. These properties are found in the texture maps mentioned above.

Encoding the BRDF into a texture is an optimisation, as the parts of the rendering function which do not depend on light or the model can be pre-calculated and stored. This reduces the overall CPU workload at runtime.

The BRDF is based on a Cook-Torrance microfacet specular model:

The specific terms mirror Epic's implementation

  • D - GGX/Throwbridge-Reitz
  • F - Epic's modified Schlick approximation
  • G - Schlick

The specifics of this model are not important for this document. This equation is mainly shown for completeness. More information can be found elsewhere online or by looking at Epic's document.

The precalculated part of the BRDF has the cosine of normal and view directions, and the roughness, as inputs. This is given by:

The outputs are a scale and bias factor used for the specular calculation. This function is generated using the PowerVR Framework's PVRUtils library.

An environment map

In this demo, the environment map is a high dynamic range (HDR) unclipped skybox in a floating-point format (R9G9B9E5).

Unclipped here means that any light sources, such as the Sun, are encoded with their real brightness, not just saturated to a lower value. This means the incoming light from real scenes can be rendered very realistically.

The environment map used here was downloaded from HDRI Haven.

The Environment Map

A pre-calculated irradiance map

This pre-encodes the light diffused by the entire scene, for any possible direction. In other words, the material-independent diffuse light contribution of an entire scene (the skybox).

This is calculated from the environment map using a command line tool which is provided as part of the PowerVR SDK. This tool can be found in the folder called ImageBasedLightingMapGenerator within the examples folder of the SDK.

A pre-calculated pre-filtered reflection map

This pre-encodes the result of light reflecting on surfaces of varying roughnesses. This is the skybox itself, blurred in such a way as to correspond to different roughnesses.

Again, this is calculated from the environment map using the command line tool mentioned above.

Although code for directional light exists, it has been disabled in this demo as the environment lighting is actually real, so looks perfectly natural in the demo without adding artificial lights.

It is worth mentioning again that the skybox was obtained from HDRI Haven. This website is highly recommended for beautiful, unclipped scenes.