Expose angle offset below (N.L)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
This commit is contained in:
@@ -351,6 +351,9 @@ PbrLightingOutput SkinPS_Common(VSOutput IN)
|
||||
lightingData.specularResponse = FresnelSchlickWithRoughness(lightingData.NdotV, surface.specularF0, surface.roughnessLinear);
|
||||
lightingData.diffuseResponse = 1.0 - lightingData.specularResponse;
|
||||
|
||||
// Angle offset for subsurface scattering through thin objects
|
||||
lightingData.angleOffset = MaterialSrg::m_angleOffset;
|
||||
|
||||
// ------- Occlusion -------
|
||||
|
||||
lightingData.diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_diffuseOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_diffuseOcclusionMapUvIndex], MaterialSrg::m_diffuseOcclusionFactor, o_diffuseOcclusion_useTexture);
|
||||
|
||||
@@ -650,6 +650,19 @@
|
||||
"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",
|
||||
@@ -657,7 +670,7 @@
|
||||
"type": "float",
|
||||
"defaultValue": 3.0,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
"softMax": 100.0
|
||||
}
|
||||
],
|
||||
"wrinkleLayers": [
|
||||
|
||||
@@ -72,6 +72,7 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||
Texture2D m_transmissionThicknessMap;
|
||||
uint m_transmissionThicknessMapUvIndex;
|
||||
float m_shrinkFactor;
|
||||
float m_angleOffset;
|
||||
|
||||
Texture2D m_wrinkle_baseColor_texture1;
|
||||
Texture2D m_wrinkle_baseColor_texture2;
|
||||
|
||||
@@ -65,10 +65,10 @@ float3 GetBackLighting(Surface surface, LightingData lightingData, float3 lightI
|
||||
{
|
||||
// Irradiance arround surface point.
|
||||
// Begin the transmittance dot product slightly before it would with the regular dot(N,L)
|
||||
float E = max(0.30 + dot(-surface.normal, dirToLight), 0.0);
|
||||
float E = saturate(lightingData.angleOffset + dot(-surface.normal, dirToLight));
|
||||
|
||||
// Transmission distance computed from shadowmaps modulated by editor-exposed parameters
|
||||
float s = transmissionDistance * surface.transmission.thickness * (50 - transmissionParams.w) * 10;
|
||||
float s = transmissionDistance * surface.transmission.thickness * (100 - transmissionParams.w) * 10;
|
||||
|
||||
// Albedo at front (surface point) is used to approximate irradiance at the back of the object
|
||||
// See observation 4 in [Jimenez J. et al, 2010]
|
||||
|
||||
+4
-1
@@ -28,9 +28,12 @@ class LightingData
|
||||
// Direction light shadow coordinates
|
||||
float3 shadowCoords[ViewSrg::MaxCascadeCount];
|
||||
|
||||
// Direction light shadow coordinates for shrinked positions
|
||||
// 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;
|
||||
|
||||
// Normalized direction from surface to camera
|
||||
float3 dirToCamera;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user