Skip to search form Skip to main content You are currently offline. Some features of the site may not work correctly. DOI: View via Publisher.
|Published (Last):||12 June 2007|
|PDF File Size:||8.75 Mb|
|ePub File Size:||16.87 Mb|
|Price:||Free* [*Free Regsitration Required]|
This document is part of the Filament project. To report errors in this document please use the project's issue tracker. Filament is a physically based rendering PBR engine for Android. The goal of Filament is to offer a set of tools and APIs for Android developers that will enable them to create high quality 2D and 3D rendering with ease. The goal of this document is to explain the equations and theory behind the material and lighting models used in Filament.
This document is intended as a reference for contributors to Filament or developers interested in the inner workings of the engine. We will provide code snippets as needed to make the relationship between theory and practice as clear as possible.
This document is not intended as a design document. It focuses solely on algorithms and its content could be used to implement PBR in any engine. Unless noted otherwise, all the 3D renderings present in this document have been generated in-engine prototype or production. Many of these 3D renderings were captured during the early stages of development of Filament and do not reflect the final quality.
Real-time rendering is an active area of research and there is a large number of equations, algorithms and implementation to choose from for every single feature that needs to be implemented the book Rendering real-time shadows , for instance, is a pages summary of dozens of shadows rendering techniques.
As such, we must first define our goals or principles, to follow Brent Burley's seminal paper Physically-based shading at Disney [ Burley12 ] before we can make informed decisions. Our primary goal is to design and implement a rendering system able to perform efficiently on mobile platforms.
Our rendering system will emphasize overall picture quality. We will however accept quality compromises to support low and medium performance GPUs. Artists need to be able to iterate often and quickly on their assets and our rendering system must allow them to do so intuitively. We must therefore provide parameters that are easy to understand for instance, no specular power, no index of refraction…. We also understand that not all developers have the luxury to work with artists.
The physically based approach of our system will allow developers to craft visually plausible materials without the need to understand the theory behind our implementation. For both artists and developers, our system will rely on as few parameters as possible to reduce trial and error and allow users to quickly master the material model. In addition, any combination of parameter values should lead to physically plausible results. Physically implausible materials must be hard to create.
Our system should use physical units everywhere possible: distances in meters or centimeters, color temperatures in Kelvin, light units in lumens or candelas, etc. A physically based approach must not preclude non-realistic rendering. User interfaces for instance will need unlit materials. While not directly related to the content of this document, it bears emphasizing our desire to keep the rendering library as small as possible so any application can bundle it without increasing the binary to undesirable sizes.
We chose to adopt PBR for its benefits from an artistic and production efficient standpoints, and because it is compatible with our goals.
Physically based rendering is a rendering method that provides a more accurate representation of materials and how they interact with light when compared to traditional real-time models. The separation of materials and lighting at the core of the PBR method makes it easier to create realistic assets that look accurate in all lighting conditions.
The sections below describe multiple material models to simplify the description of various surface features such as anisotropy or the clear coat layer.
In practice however some of these models are condensed into a single one. For instance, the standard model, the clear coat model and the anisotropic model can be combined to form a single, more flexible and powerful model. Please refer to the Materials documentation to get a description of the material models as implemented in Filament.
The goal of our model is to represent standard material appearances. Since we aim to model commonly encountered surfaces, our standard material model will focus on the BRDF and ignore the BTDF, or approximate it greatly.
Our standard model will therefore only be able to correctly mimic reflective, isotropic, dielectric or conductive surfaces with short mean free paths. The BRDF describes the surface response of a standard material as a function made of two terms:. This equation characterizes the surface response for incident light from a single direction. Commonly encountered surfaces are usually not made of a flat interface so we need a model that can characterize the interaction of light with an irregular interface.
Such BRDF states that surfaces are not smooth at a micro level, but made of a large number of randomly aligned planar surface fragments, called microfacets. However, not all microfacets with a properly oriented normal will contribute reflected light as the BRDF takes into account masking and shadowing. A microfacet BRDF is heavily influenced by a roughness parameter which describes how smooth low roughness or how rough high roughness a surface is at a micro level.
The smoother the surface, the more facets are aligned and the more pronounced the reflected light is. The rougher the surface, the fewer facets are oriented towards the camera and incoming light is scattered away from the camera after reflection, giving a blurry aspect to the specular highlights.
The roughness parameter as set by the user is called perceptualRoughness in the shader snippets throughout this document. The variable called roughness is the perceptualRoughness with a remapping explained in section 4. A microfacet model is described by the following equation where x stands for the specular or diffuse component :. It is important to note that this equation is used to integrate over the hemisphere at a micro level :.
The diagram above shows that at a macro level, the surfaces is considered flat. This helps simplify our equations by assuming that a shaded fragment lit from a single direction corresponds to a single point at the surface. At a micro level however, the surface is not flat and we cannot assume a single ray of light anymore we can however assume that the incident rays are parallel. Since the micro facets will scatter the light in different directions given a bundle of parallel incident rays, we must integrate the surface response over a hemisphere, noted m in the above diagram.
It is obviously not practical to compute the full integration over the microfacets hemisphere for each shaded fragment. We will therefore rely on approximations of the integration for both the specular and diffuse components. To better understand some of the equations and behaviors shown below, we must first clearly understand the difference between metallic conductor and non-metallic dielectric surfaces.
We saw earlier that when incident light hits a surface governed by a BRDF, the light is reflected as two separate components: the diffuse reflectance and the specular reflectance. This modelization is a simplification of how the light actually interacts with the surface. In reality, part of the incident light will penetrate the surface, scatter inside, and exit the surface again as diffuse reflectance.
Here lies the difference between conductors and dielectrics. There is no subsurface scattering occurring with purely metallic materials, which means there is no diffuse component and we will see later that this has an influence on the perceived color of the specular component.
Scattering happens in dielectrics, which means they have both specular and diffuse components. Energy conservation is one of the key components of a good BRDF for physically based rendering. An energy conservative BRDF states that the total amount of specular and diffuse reflectance energy is less than the total amount of incident energy. Without an energy conservative BRDF, artists must manually ensure that the light reflected off a surface is never more intense than the incident light.
The sections that follow describe the equations we picked for these terms. The GGX distribution described in [ Walter07 ] is a distribution with long-tailed falloff and short peak in the highlights, with a simple formulation suitable for real-time implementations. It is also a popular model, equivalent to the Trowbridge-Reitz distribution, in modern physically based renderers.
We can improve this implementation by using half precision floats. The Smith formulation is the following:. Heitz notes however that taking the height of the microfacets into account to correlate masking and shadowing leads to more accurate results.
He defines the height-correlated Smith function thusly:. It does so by rewriting the expressions as lerps :. The Fresnel effect plays an important role in the appearance of physically based materials.
This effect models the fact that the amount of light the viewer sees reflected from a surface depends on the viewing angle. When looking at the water straight down at normal incidence you can see through the water.
However, when looking further out in the distance at grazing angle, where perceived light rays are getting parallel to the surface , you will see the specular reflections on the water become more intense.
The amount of light reflected depends not only on the viewing angle, but also on the index of refraction IOR of the material. More formally, the Fresnel term defines how light reflects and refracts at the interface between two different media, or the ratio of reflected and transmitted energy. The actual value depends on the index of refraction of the interface. Observation of real world materials show that both dielectrics and conductors exhibit achromatic specular reflectance at grazing angles and that the Fresnel reflectance is 1.
Our implementation will instead use a simple Lambertian BRDF that assumes a uniform diffuse response over the microfacets hemisphere:. The Lambertian BRDF is obviously extremely efficient and delivers results close enough to more complex models. However, the diffuse part would ideally be coherent with the specular term and take into account the surface roughness.
Given our constraints we decided that the extra runtime cost does not justify the slight increase in quality. This sophisticated diffuse model also renders image-based and spherical harmonics more difficult to express and implement.
For comparison purposes, the right sphere was mirrored. The surface response is very similar with both BRDFs but the Disney one exhibits some nice retro-reflections at grazing angles look closely at the left edge of the spheres. It is important to note however that the Disney diffuse BRDF is not energy conserving as expressed here. We mentioned in section 4. Unfortunately the BRDFs explored previously suffer from two problems that we will examine below.
The Lambert diffuse BRDF does not account for the light that reflects at the surface and that is therefore not able to participate in the diffuse scattering event. The Cook-Torrance BRDF we presented earlier attempts to model several events at the microfacet level but does so by accounting for a single bounce of light.
This approximation can cause a loss of energy at high roughness, the surface is not energy preserving. In the single bounce or single scattering model, a ray of light hitting the surface can be reflected back onto another microfacet and thus be discarded because of the masking and shadowing term. If we however account for multiple bounces multiscattering , the same ray of light might escape the microfacet field and be reflected back towards the viewer.
Based on this simple explanation, we can intuitively deduce that the rougher a surface is, the higher the chances are that energy gets lost because of the failure to account for multiple scattering events. This loss of energy appears to darken rough materials. Metallic surfaces are particularly affected because all of their reflectance is specular.
An Inexpensive BRDF Model for Physically-Based Rendering