Unity Switch From Phong to GGX


Phong shading has been somewhat the gold standard as far as game engines go.  The Phong algorithm, named after founder Bui Tuong Phong, is an algorithm for how light interacts with a 3D surface.  With the upcoming Unity 5.4 release however, Unity will be moving from Phong to GGX shading.  For more details on GGX shading, you can read the original paper Microfacet Models for Refraction through Rough Surfaces.


As to why Unity is changing shader models, you can read on here, or excerpt below:

In Unity 5.3 Standard Shader we have switched to GGX as the BRDF of choice for both analytical lights such as point/directional light but also for image based lighting. Furthermore, a complete overhaul has been performed on our implementation for convolution of cube maps to achieve both accurate and noiseless results at low execution time (latter part is in Unity 5.4). The most characteristic difference between GGX and normalized Phong is that the microfacet distribution profiles associated with GGX has a higher and more narrow spike followed by a prevailing tail as we see here.

Profiles for GGX and Normalized Phong.

The impact of this on the final lit result is GGX has a brighter highlight followed by a trailing halo as shown below which gives a more realistic appearance.

Comparison between GGX and conventional normalized phong.

Cross-industry Compatible Materials

In academics physically based BRDFs use roughness as the parameter to control the microfacet distribution function. Academic roughness is defined as the root mean square slope of the profile. A common misunderstanding is that roughness maps in CG are the same as academic roughness which is not the case. The reason academic roughness is not used for texture maps or sliders is because the “blur levels” are not evenly distributed which is both very difficult to work with but also leverages the limited bit precision of a texture map poorly. To avoid confusion Unity uses smoothness instead of roughness maps where smoothness is converted into academic roughness in the shader using the formula (1-smoothness)^2. Distribution wise this is equivalent to Burley’s roughness but reversed such that the most blurry response maps to 0.0 and perfect mirror reflection maps to 1.0 which we find more intuitive.

The significance to such a standardized distribution is it allows you to import content into Unity made with external tools and achieve close/similar results. Most CG painting tools today support smoothness maps. To be clear an identical match is not guaranteed but proportionality between diffuse and specular brightness and overall blurriness of the specular reflection should be close. The following comparison shot between Unity 5 and Substance Painter was kindly provided by Wes McDermott from Allegorithmic.

As we see the visuals are very similar. I would also like to thank Wes and Allegorithmic for their collaboration and helpful iteration on this. For more details on the subject people are encouraged to check out their detailed course on PBR and Unity 5.

GameDev News

Scroll to Top