Mastering PBR Asset Creation with Substance Painter: From IBL to Custom Shaders
This article explains the fundamentals of physically based rendering (PBR) assets, the role of Substance Painter tools, image‑based lighting theory, texture export standards, and provides step‑by‑step shader code modifications to achieve consistent results between Substance Painter previews and real‑time game engines.
Background
In recent years, physically based rendering (PBR) has redefined the asset production workflow by describing object appearance with physically accurate equations.
PBR Advantages
PBR eliminates guesswork about surface properties such as specular highlights, using precise physical formulas for more realistic results.
Objects look realistic under any lighting condition.
The workflow is consistent, allowing different artists to continue each other's work seamlessly.
What is Substance?
Substance is described as “the leading software solution for 3D digital materials, inspiring intelligent tools and content to create and apply materials for 3D.” Its toolset includes Substance Painter, Substance Alchemist, Substance Designer, and Substance Source, which have become standard for creating PBR assets.
Image‑Based Lighting (IBL)
IBL uses environment cubemaps captured from the real world or generated from 3D scenes. Each pixel of the cubemap acts as a light source, providing both diffuse (low‑frequency) and specular (high‑frequency) contributions.
The diffuse part can be pre‑computed with spherical harmonics or irradiance maps, while the specular part is often approximated with GGX importance sampling. Real‑time engines usually reduce the number of environment samples to one using Split‑Sum Approximation.
Problems Discussed
When using Substance Painter (SP) to create high‑quality PBR assets, artists encounter mismatches between the SP preview and the final appearance in game engines, requiring additional texture adjustments.
Solution Overview
Texture Production Workflow
SP can quickly generate the required PBR maps, but certain standards must be followed.
Base Color Map Standards
For dielectrics, the Base Color map stores diffuse color; for conductors it stores reflectance values (180‑255 sRGB). Gray‑scale maps such as metallic and roughness remain linear.
Export Color Space
PBR rendering is performed in linear space. SP exports color maps in sRGB (gamma‑encoded) while gray‑scale maps stay linear. When importing into engines like Unity, enable sRGB for color maps but not for gray‑scale maps.
Shader Implementation in SP
The Metal‑Roughness shader can be found under the SP resources directory.
<code>// Example of shader header import
import lib-sss.glsl
// Uniform declaration
uniform SamplerSparse basecolor_tex;
// Main shading function
void shade(V2F inputs) {
// IBL diffuse using second‑order spherical harmonics
diffuseShadingOutput(occlusion * envIrradiance(vectors.normal));
// IBL specular using GGX importance sampling
specularShadingOutput(specOcclusion * pbrComputeSpecular(vectors, specColor, roughness));
}
</code>Two strategies for handling the IBL specular term were considered:
Pre‑filter the environment map offline and sample its mipmap levels (accurate but requires re‑processing for each environment).
Ignore high‑frequency differences and use a single environment map for fast iteration (chosen approach).
Adding Directional Light
A custom uniform for light color is added, and the shader combines Lambert and Cook‑Torrance models for direct lighting.
<code>// Directional light uniform
uniform vec3 light_color;
</code>Results show that with the added directional light and proper tone‑mapping, the SP preview matches the Unity rendering.
Conclusion
Although SP only exposes shader functionality, the described workflow allows artists to achieve expected PBR results and integrate them into real‑time engines.
Kuaishou Large Model
Official Kuaishou Account
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.