Add EnhancedPBR support for thin object transmission

Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
This commit is contained in:
Santi Paprika
2021-12-04 09:59:16 +01:00
parent d951cd332f
commit 6172bb0034
3 changed files with 37 additions and 1 deletions
@@ -1223,6 +1223,32 @@
"min": 0.0,
"softMax": 20.0
},
{
"name": "shrinkFactor",
"displayName": " Shrink Factor",
"description": "Shrink (absolute) offset towards the normal opposite direction to ensure correct shadow map projection",
"type": "float",
"defaultValue": 0.005,
"min": 0.0,
"softMax": 0.05,
"connection": {
"type": "ShaderInput",
"name": "m_shrinkFactor"
}
},
{
"name": "angleOffset",
"displayName": " Angle Offset",
"description": "Angle to accept below (N . L = 0) in scattering through thin objects",
"type": "float",
"defaultValue": 0.1,
"min": -1.0,
"softMax": 1.0,
"connection": {
"type": "ShaderInput",
"name": "m_angleOffset"
}
},
{
"name": "transmissionScale",
"displayName": " Scale",
@@ -1230,7 +1256,7 @@
"type": "float",
"defaultValue": 3.0,
"min": 0.0,
"softMax": 20.0
"softMax": 100.0
}
],
"detailLayerGroup": [
@@ -100,6 +100,8 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
float4 m_transmissionTintThickness;
Texture2D m_transmissionThicknessMap;
uint m_transmissionThicknessMapUvIndex;
float m_shrinkFactor;
float m_angleOffset;
}
// Callback function for ParallaxMapping.azsli
@@ -275,6 +275,14 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
lightingData.diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_diffuseOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_diffuseOcclusionMapUvIndex], MaterialSrg::m_diffuseOcclusionFactor, o_diffuseOcclusion_useTexture);
lightingData.specularOcclusion = GetOcclusionInput(MaterialSrg::m_specularOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_specularOcclusionMapUvIndex], MaterialSrg::m_specularOcclusionFactor, o_specularOcclusion_useTexture);
// ------- Thin Object Light Transmission -------
// Angle offset for subsurface scattering through thin objects
lightingData.angleOffset = MaterialSrg::m_angleOffset;
// Shrink (absolute) offset towards the normal opposite direction to ensure correct shadow map projection
lightingData.shrinkFactor = MaterialSrg::m_shrinkFactor;
// ------- Clearcoat -------
// [GFX TODO][ATOM-14603]: Clean up the double uses of these clear coat flags