|
|
|
|
|
|
float NdotL = dot(N, L); |
|
|
|
float LdotV = dot(L, V); |
|
|
|
|
|
|
|
bool mixedThicknessMode = HasFeatureFlag(bsdfData.materialFeatures, MATERIAL_FEATURE_FLAGS_TRANSMISSION_MODE_MIXED_THICKNESS); |
|
|
|
|
|
|
|
UNITY_BRANCH |
|
|
|
if (mixedThicknessMode && NdotL < 0 && lightData.shadowIndex >= 0) |
|
|
|
{ |
|
|
|
// Make sure we do not sample the shadow map twice. |
|
|
|
lightData.shadowIndex = -1; |
|
|
|
} |
|
|
|
|
|
|
|
float3 color; |
|
|
|
float attenuation; |
|
|
|
EvaluateLight_Directional(lightLoopContext, posInput, lightData, bakeLightingData, N, L, color, attenuation); |
|
|
|
|
|
|
lighting.specular *= intensity * lightData.specularScale; |
|
|
|
} |
|
|
|
|
|
|
|
// The mixed thickness mode is not supported by directional lights due to poor quality and high performance impact. |
|
|
|
bool mixedThicknessMode = HasFeatureFlag(bsdfData.materialFeatures, MATERIAL_FEATURE_FLAGS_TRANSMISSION_MODE_MIXED_THICKNESS); |
|
|
|
|
|
|
|
if (HasFeatureFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION)) |
|
|
|
if (HasFeatureFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION) && !mixedThicknessMode) |
|
|
|
{ |
|
|
|
// We use diffuse lighting for accumulation since it is going to be blurred during the SSS pass. |
|
|
|
lighting.diffuse += EvaluateTransmission(bsdfData, bsdfData.transmittance, NdotL, NdotV, LdotV, attenuation * lightData.diffuseScale); |
|
|
|