It is possible to use custom shaders written in GLSL and use them inside Substance Painter.
You can either :
- Find already existing shaders on Substance Share.
- Write your own shader. The documentation to write those shaders is available via the menu Help > Documentation > Shader API menu entry inside Substance Painter.
Shader API Update
Below are important updates that happened to the Shader API.
With the introduction of the Sparse Virtual Textures (SVT) system, shaders have been modified to take into account Sparse Textures. This mean sampling textures is now different than before. While older shaders will continue working, old sampling method are considered deprecated and shaders should be updated to the latest API change (otherwise artifacts may appear, see : Mesh flash to white when moving camera ).
Declaring an engine texture (such as channels) was :
Is now :
Sampling a texture was :
Is now :
We recommend taking a look at our default shader pbr-metal-rough.glsl for an overview of how the shaders now behave. For further details please consult the new lib-sparse.glsl file as well as the updated lib-sampler.glsl file from the Shader API documentation.
- Add a new lib-pbr-aniso.glsl library to help visualizing anisotropic specular highlight
- Add a new lib-sparse.glsl library to help channel sampling by taking care of mipmaps availability
- Update shader libraries interfaces to take care of this safe sampling
- Deprecation: The previous functions based on the vec2 texture coordinates and the texture sampler have been deprecated (please use new signatures)
- lib-pom.glsl: Add a applyParallaxOffset function to simplify to use of parallax occlusion effect
- lib-sampler.glsl: Split all channel sampling helpers to have both value interpretation and sampling helpers
The main shade() function now returns calls to specific functions rather than a simple vec4. The pbrComputeBRDF() has been replaced by separate functions to compute each term individually.
Take a look at how the default pbr-metal-rough.glsl shader provided with Substance Painter is written to get an overview of the new procedure. For further details refer to the surface-shader.glsl page in the Shader API.
Surface shader API change: the shade function signature has changed, see surface-shader.glsl
- The shadeShadow function is no longer used and can safely be removed from custom surface shaders
- Add Subsurface Scattering support, see surface-shader.glsl and lib-sss.glsl for details
- lib-pbr.glsl: the pbrComputeBRDF function has been removed. See pbr-metal-rough.glsl example to know how to use the library now
- New engine parameters have been added: texture_blue_noise, aspect_ratio, camera_vp_matrix_inverse, environment_exposure, environment_rotation, fovy, main_light and screen_size. See all-engine-params.glsl for details
- Add the description metadata to provide tooltips for custom shader parameters