Maya Realtime PBR Shader
DirectX PBR Shader implementation for Maya`s Viewport 2.0. Works exactly as the native Ubershader that ships with Maya and its similar to the one in Unreal Engine or Substance Painter.
Maya Viewport 2.0 PBR Shader
If your project uses a physically based material workflow (Substance Painter / Quixel Mixer) you will greatly benefit by using this shader to enhance Maya`s native rendering abilities.
It`s a “principled” BRDF
Based on Unreal`s shading model which in turn is based on Disney`s, it follows a set of simple principles:
- Intuitive rather than physical parameters should be used.
- There should be as few parameters as possible
- Parameters should be zero to one over their plausible range.
- Parameters should be allowed to be pushed beyond their plausible range where it makes sense.
- All combinations of parameters should be as robust and plausible as possible.
Inputs and Switches
- Linear space lighting (Switch) – Perform gamma correction.
- Tone Mapping Function (Dropbox) – Change tonemapping ( None, Uncharted, Aces, Filmic )
- Shadows (Switch) – Enable / Disable Shadows Map
- Shadow Strenght (Slider) – Control the shadow amount
- Shadow Bias (Slider) – Pushes the shadows into the surfaces
- Inverse Square lighting (Switch) – The light falloff function
- Double Sided Lighting (Switch) – Enable normals on both sides
- Base Color (Value and Texture2D)
- Metallic (Value and Texture2D)
- Specular (Value and Texture2D)
- Roughness (Value and Texture2D)
- Normal (Value and Texture2D)
- Ambient Occlusion (Value and Texture2D)
- Extra switches for choosing between flat values or textures
Values and Texture Maps
This shader uses the Cook-Torrance BRDF model ( Microfacet specular = D*G*F / (4*NoL*NoV) = D*Vis*F ). For these examples we used a gamma correction of 2.2. Note: Your results or comparisons might vary depending on gamma-correction / tone mapping or any other modifications that might occur.
Normal distribution function – GGX / Trowbridge-Reitz – “Walter et al. 2007, “Microfacet models for refraction through rough surfaces”
Geometric shadowing function – Appoximation of joint Smith term for GGX “Heitz 2014, “Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs”
Fresnel function – Schlick 1994, “An Inexpensive BRDF Model for Physically-Based Rendering”
To better match visually the shader in unreal we also added an extra rim/fresnel function:
Diffuse function Burley 2012, “Physically-Based Shading at Disney”
Pre-calculated environment maps for different roughness values, stored in the mip-map levels of a cubemap. This is the typical approach used by much of the game industry. You can bake your own environment maps in the compatible .dds format using a tool like IBLBaker (free).