ShaderFX TGA PBL shader

I’ve finally gotten around to porting the TGA Physically Based Shader to the new ShaderFX format for Maya. In essence this shader is very similar to the old one, but there are a few improvements.

For reference and discussion of this shader please visit this thread on the polycount forum.

The code for light contribution(color & intensity) and shadows are blatantly copy pasted from the TraditionalGameSurfaceShader supplied with ShaderFX in Maya. Did not feel inclined to re-invent the wheel. Author of these snippets? Kees Rijnen? The model and textures of the arm below created by Ronja Melin.

Shout out to all the students at The Game Assembly(TGA) for their help in testing and using this shader.

Highlight Features

  • A real life material based fresnel term that alters specularity and reflections.
  • A substance texture to mimic how materials reflect and refract light in real life.
  • A roughness texture to define a materials surface structure(smooth/rough).
  • Image based lighting via a cube map for reflections and ambient lighting.
  • Roughness controlled sharpness of reflections using pre-blurred mip levels of the cube map.
  • Linear shading pipeline. Albedo, roughness, substance, ambient occlusion and the cube map are converted to linear.
  • Transparency support through the Albedo texture alpha channel.
  • Energy conservation for light amount for both direct and ambient light.
  • A bundled cheat sheet image with color swatches for several substance values as well as a bundled cube map to get started.
  • Optional Blended Normals diffuse lighting method for skin level SSS-effect along with option mask texture.
  • Shadows with directional and spot lights.
  • User defined amount of Maya native lights in viewport.
  • SSAO and MSAA through the VP2.0 in Maya(not a feature of the shader itself).
  • Exposure and Gamma are tweakable in the viewport in Maya 2015 extensions1 for better overall contrast(not a feature of the shader itself).
  • Supports both full substance texture or metalness approach to define Index Of Refraction values.
  • Easily organized shader network for user defined input textures/colors.
  • Specular/Reflection sharpness/blurriness matched when using Lys( generated specular(ggx) cube maps.
  • Optional emissive/full-bright texture to fake light emitting areas.  New!


You need Maya 2015 Service Pack 5 and DirectX as the renderer for Viewport 2.0(OpenGL is default). You can chance from OpenGL->DirectX under Window -> Settings/Preferences -> Preferences -> Display -> Render engine (at the very bottom). Also, as of Maya 2016 the VP 2.0 defaults to using it’s own linear -> sRGB conversion, set it to “RAW” for intended look.

Ideas for future improvements

  • Tutorial video for getting started and using the shader.
  • Alternative anisotropic specularity model.
  • Multi-pass mode to get reflections on transparent surfaces to mimic glass like materials.
  • DX11 Tesselation and displacement.
  • Vertex color tinting.
  • Some kind of SSS approximation other than blended normals(?). Maybe something like this?

Technical Requirements

  • Maya 2015 Service Pack 3(?) or newer. Run with DirectX as render engine.
  • Maya 2015 LT(no info on this but has ShaderFX support)? Run with DirectX as render engine.
  • Maya 2014 LT(no info on this but has ShaderFX support)? Run with DirectX as render engine.
  • 3D Studio Max 2015(no info on this but has ShaderFX support)?

Known Issues

  • Haven’t found a way to get cube map image size or number of mip-map levels to automatically handle this. User has to manually set cube map resolution/side. Default at 512px/side.


Using the shader in Maya

  1. Apply a ShaderFX material to your object.
  2. Open the ShaderFX editor through the material in the attribute editor.
  3. File > Import Graph > point to the SFX file.
  4. Close the ShaderFX editor to show the shader attributes in the Attribute editor.
  5. Tip: Use MEL command “shaderfx -update” to easily refresh all the textures in the shader.
  6. Tip: Rename the .sfx file to “startup.sfx” and place it into “Documents\maya\ShaderFX\ Scenes”. This will set the shader as the default shader graph to use for new ShaderFX materials.