We just introduced Physically Based Shading (PBS) and now what? Hopefully your models are looking slightly better or maybe not and you would really like to understand how to fix it, what this PBR thing is all about and how do i get this to be less shinny! Let’s try to help you here and bring peace, beauty & harmony in the metaverse…
Big thanks to the alpha users who tested the early builds the PR SeventyOneNinetyOne and helped us refine the behavior, in particular @Menithal and @OmegaHeron.
Thanks much to the usual suspects at hifi for all the contribution & support…
Please post your questions here in the thread and we will make this a living FAQ about PBS.
What this is all about?
PBS is a broad term describing the shading algorithm of a material surface which is much more realistic compared to traditional shading equation and material model (Gouraud, Blinn or Phong). PBS is now commonly used in the best graphics engine such as Unreal, CryEngine or Unity and many others and is probably what you are looking at in any AAA game on console or PC. In Hifi, we were using Phong up until this PR and we finally adjusted our pipeline to migrate to PBR.
Need before after capture
Migrating to PBS improves our modeling tool chain from the modeling software Blender and Maya with a better export to FBX and then into Hifi. You can now take advantage of better tools to generate the required textures and material description such as SubstancePainter.
What are the fundamental properties of hifi PBR Material ?
Albedo: The color of the surface expressed as sRGB, same as the standard diffuse color if non metallic, the actual metal “fresnel” color if metallic.
Metallic: 0 or 1, with this 2 kinds of material we can cover a wide range of materials encountered in everyday life. For now, values in the range ]0,1[ are simply rounded to 0 or 1 with no other side effect. The metallic property can be think of the “specular color” in the traditional phong model.
Roughness: The roughness (opposite of smoothness) of a surface, if 0 then surface is perfectly flat behaving like a mirror, if 1 then surface is infinitely rough. Roughness is the most important property of the material affecting the look of the specular highlight on the surface and the way it “spreads”. Very rough surface infinitely spread the highlight whereas smooth surface concentrate more and more the reflection highlight to the point of a perfect mirror. Roughness is the inverse of the “smouthness” or “glossiness” or “specularPower” used in legacy material model.
Extra Material Properties supported
Aside from the core properties Albedo, Metallic & Roughness the hifi Material also support:
Need the details
Is there an official Material export reference to now how materials are defined from the modeling tool to hifi ?
Yes, this document Version 03/2016 list all the material fields used by hifi, how they are imported from FBX file and lastly how the modeling tool are exporting their material to fbx.
This document is our current reference to check if the behavior of an exported model material is correct or not.
We are working on creating reference models for each individual cases, to be continued…
In Blender, how do i create a PBR material that works in Hifi ?
The recommended path to export models from Blender is to export to FBX file.
Working in Blender Render, simply use regular Material and Texture assignments and use the following properties:
- About Diffuse
– Diffuse.Color => Albedo color
– Diffuse.ColorMap => Albedo Texture color
The constant color is multiplied by the texture so put white in the constant color to avoid any unexpected coloring of the map. The recommended format of the map is PNG, the Alpha channel can be used to encode mask or transparency, at load time, hifi will detect if the alpha channel is useful for the transparency property of the Material. The"Intensity" field or the “name” of the diffuse model is not used by Hifi.
- About Specular
– Specular.Intensity => Metallic value
– Specular.IntensityMap => Metallic Texture
– Specular.Hardness => Smouthness value
Blender Hardness value range is [0, 512] which is remapped to [0,1] in the fbx smoothness property which we convert to rougnhess at load time in Hifi
– Specular.HardnessMap => Smoothness Texture
When loading the Smoothness texture from a Material, hifi, invert the pixel values to convert it into a Roughess map
- About Emissive & Lightmap
– Emit => Emissive
– Ambient => Lightmap
– Occlusion map is not supported from blender at the moment
How can i check and debug the values used for a model in the Hifi Engine
The script tool “debugFramebuffer.js” located (for now) in utilities/tools/render/ let’s you see the different channels of material as used by the lighting in a split screen. This information comes from the deferred buffer so you only see the Opaque fragments information.
The split screen boundary can be dragged to see less or more of the debug view.
Here is an example of the tool used when looking at an object and trying to understand the roughness information:
And now looking at the normal information:
If you are interested to know more and understand the fundamentals of PBR I would highly recommend all the Siggraph courses organized in particular by Naty Hoffman and then Stephen Hill
We also spend a lot of time in Sebastien Lagarde’s blog and many other graphics developers’ blogs and presentations from GDC and Siggraph.
Detail our implementation and the reference giants