Last updated on
Jul 13, 2023
- Getting Started overview
- Activation and licenses
- System requirements
- Project creation
-
Export
- Export overview
- Export window
- Export presets
- Glossary
- Performance
- Assets
- Substance 3D Assets
- Color picker
- Display settings
- History
- Layer stack
- Main menu
- Project configuration
- Properties
- Settings
- Shader settings
- Texture Set
- Toolbars
- Viewport
- Miscellaneous
- Painting overview
- Tool list
- Straight line
- Lazy mouse
- Symmetry
- Fill projections
-
Presets
- Presets overview
- Creating and saving presets
- Creating particles presets
- Photoshop brush presets (ABR)
- Dynamic strokes
- Advanced channel painting
- Vector graphic (.svg & .ai)
- Text resource
- Creating custom effects
- Importing assets
- Automatic UV Unwrapping
- Physical size
- Smart Materials and Masks
- Subsurface Scattering
- Dynamic Material Layering
- UV Reprojection
- UV Tiles
- Color Management
- Post Processing
- Iray Renderer
- Plugins
- Sparse Virtual Textures
- Custom Shaders
- SpaceMouse® by 3Dconnexion
- Universal Scene Description (USD)
- Send to
- Performance Guidelines
- Configuring Pens and Tablets
- Exporting the log file
- Exporting a DXDiag
-
Technical issues
-
GPU Issues
- Crash when working with overclocked GPU
- Forcing the external GPU on Mac OS
- GPU drivers compatibility
- GPU drivers crash with long computations (TDR crash)
- GPU has outdated drivers
- GPU is not recognized
- GPU is not recognized and is mentionned as GDI Generic
- Issues with Nvidia GPUs on recent Mac OS versions
- Multi/Bi-GPU
- Running on integrated GPU
- Painter doesn't start on the right GPU
- Startup Issues
- Rendering Issues
- Stability Issues
- Miscellaneous Issues
-
GPU Issues
-
Workflow Issues
- Export Issues
- Tools Issues
- Project Issues
- Library Issues
- Viewport Issues
- Plugins Issues
- License Issues
- Installation and preferences
- Configuration
- Resource management
- Scripts and plugins
- Release notes overview
- All Changes
- Version 10.1
- Version 10.0
- Version 9.1
-
Old versions
- Version 9.0
- Version 8.3
- Version 8.2
- Version 8.1
- Version 7.4
- Version 7.3
- Version 7.2
- Version 2021.1 (7.1.0)
- Version 2020.2 (6.2.0)
- Version 2020.1 (6.1.0)
- Version 2019.3
- Version 2019.2
- Version 2019.1
- Version 2018.3
- Version 2018.2
- Version 2018.1
- Version 2017.4
- Version 2017.3
- Version 2017.2
- Version 2017.1
- Version 2.6
- Version 2.5
- Version 2.4
- Version 2.3
- Version 2.2
- Substance 3D home
- Home
-
Getting Started
- Getting Started overview
- Activation and licenses
- System requirements
- Project creation
-
Export
- Export overview
- Export window
- Export presets
- Glossary
- Performance
-
Interface
- Assets
- Substance 3D Assets
- Color picker
- Display settings
- History
- Layer stack
- Main menu
- Project configuration
- Properties
- Settings
- Shader settings
- Texture Set
- Toolbars
- Viewport
- Miscellaneous
-
Painting
- Painting overview
- Tool list
- Straight line
- Lazy mouse
- Symmetry
- Fill projections
-
Presets
- Presets overview
- Creating and saving presets
- Creating particles presets
- Photoshop brush presets (ABR)
- Dynamic strokes
- Advanced channel painting
- Vector graphic (.svg & .ai)
- Text resource
- Effects
- Baking
-
Content
- Creating custom effects
- Importing assets
-
Features
- Automatic UV Unwrapping
- Physical size
- Smart Materials and Masks
- Subsurface Scattering
- Dynamic Material Layering
- UV Reprojection
- UV Tiles
- Color Management
- Post Processing
- Iray Renderer
- Plugins
- Sparse Virtual Textures
- Custom Shaders
- SpaceMouse® by 3Dconnexion
- Universal Scene Description (USD)
- Send to
-
Technical Support
- Performance Guidelines
- Configuring Pens and Tablets
- Exporting the log file
- Exporting a DXDiag
-
Technical issues
-
GPU Issues
- Crash when working with overclocked GPU
- Forcing the external GPU on Mac OS
- GPU drivers compatibility
- GPU drivers crash with long computations (TDR crash)
- GPU has outdated drivers
- GPU is not recognized
- GPU is not recognized and is mentionned as GDI Generic
- Issues with Nvidia GPUs on recent Mac OS versions
- Multi/Bi-GPU
- Running on integrated GPU
- Painter doesn't start on the right GPU
- Startup Issues
- Rendering Issues
- Stability Issues
- Miscellaneous Issues
-
GPU Issues
-
Workflow Issues
- Export Issues
- Tools Issues
- Project Issues
- Library Issues
- Viewport Issues
- Plugins Issues
- License Issues
-
Pipeline and integration
- Installation and preferences
- Configuration
- Resource management
-
Release notes
- Release notes overview
- All Changes
- Version 10.1
- Version 10.0
- Version 9.1
-
Old versions
- Version 9.0
- Version 8.3
- Version 8.2
- Version 8.1
- Version 7.4
- Version 7.3
- Version 7.2
- Version 2021.1 (7.1.0)
- Version 2020.2 (6.2.0)
- Version 2020.1 (6.1.0)
- Version 2019.3
- Version 2019.2
- Version 2019.1
- Version 2018.3
- Version 2018.2
- Version 2018.1
- Version 2017.4
- Version 2017.3
- Version 2017.2
- Version 2017.1
- Version 2.6
- Version 2.5
- Version 2.4
- Version 2.3
- Version 2.2
PBR Metal Rough - Shader API
Allegorithmic Metal/Rough PBR shader
Import from libraries.
import lib-sss.glsl
import lib-pbr.glsl
import lib-emissive.glsl
import lib-pom.glsl
import lib-utils.glsl
import lib-sss.glsl
import lib-pbr.glsl
import lib-emissive.glsl
import lib-pom.glsl
import lib-utils.glsl
import lib-sss.glsl import lib-pbr.glsl import lib-emissive.glsl import lib-pom.glsl import lib-utils.glsl
Declare the iray mdl material to use with this shader.
//: metadata {
//: "mdl":"mdl::alg::materials::skin_metallic_roughness::skin_metallic_roughness"
//: }
//: metadata {
//: "mdl":"mdl::alg::materials::skin_metallic_roughness::skin_metallic_roughness"
//: }
//: metadata { //: "mdl":"mdl::alg::materials::skin_metallic_roughness::skin_metallic_roughness" //: }
Channels needed for metal/rough workflow are bound here.
//: param auto channel_basecolor
uniform SamplerSparse basecolor_tex;
//: param auto channel_roughness
uniform SamplerSparse roughness_tex;
//: param auto channel_metallic
uniform SamplerSparse metallic_tex;
//: param auto channel_specularlevel
uniform SamplerSparse specularlevel_tex;
//: param auto channel_basecolor
uniform SamplerSparse basecolor_tex;
//: param auto channel_roughness
uniform SamplerSparse roughness_tex;
//: param auto channel_metallic
uniform SamplerSparse metallic_tex;
//: param auto channel_specularlevel
uniform SamplerSparse specularlevel_tex;
//: param auto channel_basecolor uniform SamplerSparse basecolor_tex; //: param auto channel_roughness uniform SamplerSparse roughness_tex; //: param auto channel_metallic uniform SamplerSparse metallic_tex; //: param auto channel_specularlevel uniform SamplerSparse specularlevel_tex;
Shader entry point.
void shade(V2F inputs)
{
// Apply parallax occlusion mapping if possible
vec3 viewTS = worldSpaceToTangentSpace(getEyeVec(inputs.position), inputs);
applyParallaxOffset(inputs, viewTS);
// Fetch material parameters, and conversion to the specular/roughness model
float roughness = getRoughness(roughness_tex, inputs.sparse_coord);
vec3 baseColor = getBaseColor(basecolor_tex, inputs.sparse_coord);
float metallic = getMetallic(metallic_tex, inputs.sparse_coord);
float specularLevel = getSpecularLevel(specularlevel_tex, inputs.sparse_coord);
vec3 diffColor = generateDiffuseColor(baseColor, metallic);
vec3 specColor = generateSpecularColor(specularLevel, baseColor, metallic);
// Get detail (ambient occlusion) and global (shadow) occlusion factors
float occlusion = getAO(inputs.sparse_coord) * getShadowFactor();
float specOcclusion = specularOcclusionCorrection(occlusion, metallic, roughness);
LocalVectors vectors = computeLocalFrame(inputs);
// Feed parameters for a physically based BRDF integration
emissiveColorOutput(pbrComputeEmissive(emissive_tex, inputs.sparse_coord));
albedoOutput(diffColor);
diffuseShadingOutput(occlusion * envIrradiance(vectors.normal));
specularShadingOutput(specOcclusion * pbrComputeSpecular(vectors, specColor, roughness));
sssCoefficientsOutput(getSSSCoefficients(inputs.sparse_coord));
}
void shade(V2F inputs)
{
// Apply parallax occlusion mapping if possible
vec3 viewTS = worldSpaceToTangentSpace(getEyeVec(inputs.position), inputs);
applyParallaxOffset(inputs, viewTS);
// Fetch material parameters, and conversion to the specular/roughness model
float roughness = getRoughness(roughness_tex, inputs.sparse_coord);
vec3 baseColor = getBaseColor(basecolor_tex, inputs.sparse_coord);
float metallic = getMetallic(metallic_tex, inputs.sparse_coord);
float specularLevel = getSpecularLevel(specularlevel_tex, inputs.sparse_coord);
vec3 diffColor = generateDiffuseColor(baseColor, metallic);
vec3 specColor = generateSpecularColor(specularLevel, baseColor, metallic);
// Get detail (ambient occlusion) and global (shadow) occlusion factors
float occlusion = getAO(inputs.sparse_coord) * getShadowFactor();
float specOcclusion = specularOcclusionCorrection(occlusion, metallic, roughness);
LocalVectors vectors = computeLocalFrame(inputs);
// Feed parameters for a physically based BRDF integration
emissiveColorOutput(pbrComputeEmissive(emissive_tex, inputs.sparse_coord));
albedoOutput(diffColor);
diffuseShadingOutput(occlusion * envIrradiance(vectors.normal));
specularShadingOutput(specOcclusion * pbrComputeSpecular(vectors, specColor, roughness));
sssCoefficientsOutput(getSSSCoefficients(inputs.sparse_coord));
}
void shade(V2F inputs) { // Apply parallax occlusion mapping if possible vec3 viewTS = worldSpaceToTangentSpace(getEyeVec(inputs.position), inputs); applyParallaxOffset(inputs, viewTS); // Fetch material parameters, and conversion to the specular/roughness model float roughness = getRoughness(roughness_tex, inputs.sparse_coord); vec3 baseColor = getBaseColor(basecolor_tex, inputs.sparse_coord); float metallic = getMetallic(metallic_tex, inputs.sparse_coord); float specularLevel = getSpecularLevel(specularlevel_tex, inputs.sparse_coord); vec3 diffColor = generateDiffuseColor(baseColor, metallic); vec3 specColor = generateSpecularColor(specularLevel, baseColor, metallic); // Get detail (ambient occlusion) and global (shadow) occlusion factors float occlusion = getAO(inputs.sparse_coord) * getShadowFactor(); float specOcclusion = specularOcclusionCorrection(occlusion, metallic, roughness); LocalVectors vectors = computeLocalFrame(inputs); // Feed parameters for a physically based BRDF integration emissiveColorOutput(pbrComputeEmissive(emissive_tex, inputs.sparse_coord)); albedoOutput(diffColor); diffuseShadingOutput(occlusion * envIrradiance(vectors.normal)); specularShadingOutput(specOcclusion * pbrComputeSpecular(vectors, specColor, roughness)); sssCoefficientsOutput(getSSSCoefficients(inputs.sparse_coord)); }