Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
This commit is contained in:
Santi Paprika
2021-12-23 20:29:42 +01:00
parent eda405f5f1
commit 46abff3093
8 changed files with 14 additions and 14 deletions
@@ -1237,8 +1237,8 @@
}
},
{
"name": "angleOffset",
"displayName": " Angle Offset",
"name": "transmissionAngleBias",
"displayName": " Angle Bias",
"description": "cosine of angle to extend below (N . L = 0) in scattering through thin objects",
"type": "float",
"defaultValue": 0.1,
@@ -1246,7 +1246,7 @@
"softMax": 1.0,
"connection": {
"type": "ShaderInput",
"name": "m_angleOffset"
"name": "m_transmissionNdLBias"
}
},
{
@@ -101,7 +101,7 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
Texture2D m_transmissionThicknessMap;
uint m_transmissionThicknessMapUvIndex;
float m_shrinkFactor;
float m_angleOffset;
float m_transmissionNdLBias;
float m_distanceAttenuation;
}
@@ -278,7 +278,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// ------- Thin Object Light Transmission -------
// Angle offset for subsurface scattering through thin objects
lightingData.angleOffset = MaterialSrg::m_angleOffset;
lightingData.transmissionNdLBias = MaterialSrg::m_transmissionNdLBias;
// Shrink (absolute) offset towards the normal opposite direction to ensure correct shadow map projection
lightingData.shrinkFactor = MaterialSrg::m_shrinkFactor;
@@ -344,7 +344,7 @@ PbrLightingOutput SkinPS_Common(VSOutput IN)
// ------- Thin Object Light Transmission -------
// Angle offset for subsurface scattering through thin objects
lightingData.angleOffset = MaterialSrg::m_angleOffset;
lightingData.transmissionNdLBias = MaterialSrg::m_transmissionNdLBias;
// Shrink (absolute) offset towards the normal opposite direction to ensure correct shadow map projection
lightingData.shrinkFactor = MaterialSrg::m_shrinkFactor;
@@ -651,8 +651,8 @@
}
},
{
"name": "angleOffset",
"displayName": " Angle Offset",
"name": "transmissionAngleBias",
"displayName": " Angle Bias",
"description": "cosine of angle to extend below (N . L = 0) in scattering through thin objects",
"type": "float",
"defaultValue": 0.1,
@@ -660,7 +660,7 @@
"softMax": 1.0,
"connection": {
"type": "ShaderInput",
"name": "m_angleOffset"
"name": "m_transmissionNdLBias"
}
},
{
@@ -72,7 +72,7 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
Texture2D m_transmissionThicknessMap;
uint m_transmissionThicknessMapUvIndex;
float m_shrinkFactor;
float m_angleOffset;
float m_transmissionNdLBias;
float m_distanceAttenuation;
Texture2D m_wrinkle_baseColor_texture1;
@@ -71,8 +71,8 @@ float3 GetBackLighting(Surface surface, LightingData lightingData, float3 lightI
}
// Irradiance arround surface point.
// Increase angle of influence (angle(N,L) -> angle(N,L) + acos(angleOffset)) to smooth transition regions
float3 E = surface.albedo * max(lightingData.angleOffset + dot(-surface.normal, dirToLight),0.0);
// Increase angle of influence (angle(N,L) -> angle(N,L) + acos(transmissionNdLBias)) to smooth transition regions
float3 E = surface.albedo * max(lightingData.transmissionNdLBias + dot(-surface.normal, dirToLight),0.0);
// Transmission distance modulated by hardcoded constant (could be exposed as a weight of scattering distance for transmission)
float s = transmissionDistance * 100.0;
@@ -31,8 +31,8 @@ class LightingData
// Direction light shadow coordinates for shrinked positions (used in scattering through thin objects)
float3 shrinkedShadowCoords[ViewSrg::MaxCascadeCount];
// Angle to accept below (N . L = 0) in scattering through thin objects
float angleOffset;
// (N . L) to accept below (N . L = 0) in scattering through thin objects
float transmissionNdLBias;
// Shrink (absolute) offset towards the normal opposite direction to ensure correct shadow map projection
float shrinkFactor;