|
|
|
|
|
|
void EvaluateLight_Directional(LightLoopContext lightLoopContext, PositionInputs posInput, |
|
|
|
DirectionalLightData lightData, BakeLightingData bakeLightingData, |
|
|
|
float3 N, float3 L, |
|
|
|
out float3 color, out float attenuation, out float attenuationNoContactShadow) |
|
|
|
out float3 color, out float attenuation, out float attenuationNoContactShadows) |
|
|
|
float contactShadow = 1.0; |
|
|
|
|
|
|
|
color = lightData.color; |
|
|
|
attenuation = 1.0; // Note: no volumetric attenuation along shadow rays for directional lights |
|
|
|
|
|
|
// Note: There is no shadowDimmer when there is no shadow mask |
|
|
|
#endif |
|
|
|
|
|
|
|
attenuationNoContactShadow = attenuation * shadow; |
|
|
|
|
|
|
|
#if (SHADERPASS != SHADERPASS_VOLUMETRIC_LIGHTING) |
|
|
|
float contactShadow = GetContactShadow(lightLoopContext, lightData.contactShadowIndex); |
|
|
|
shadow = min(shadow, contactShadow); |
|
|
|
#if (SHADERPASS != SHADERPASS_VOLUMETRIC_LIGHTING && !defined(_SURFACE_TYPE_TRANSPARENT)) |
|
|
|
contactShadow = GetContactShadow(lightLoopContext, lightData.contactShadowIndex); |
|
|
|
attenuation *= shadow; |
|
|
|
attenuationNoContactShadows = shadow * attenuation; |
|
|
|
attenuation *= min(shadow, contactShadow); |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------------- |
|
|
|
|
|
|
float shadowMask = 1.0; |
|
|
|
float contactShadow = 1.0; |
|
|
|
|
|
|
|
attenuationNoContactShadows = 1; |
|
|
|
color = lightData.color; |
|
|
|
attenuation = SmoothPunctualLightAttenuation(distances, lightData.invSqrAttenuationRadius, |
|
|
|
lightData.angleScale, lightData.angleOffset); |
|
|
|
|
|
|
shadow = lerp(1.0, shadow, lightData.shadowDimmer); |
|
|
|
#endif |
|
|
|
|
|
|
|
attenuationNoContactShadows = shadow * attenuation; |
|
|
|
|
|
|
|
#if (SHADERPASS != SHADERPASS_VOLUMETRIC_LIGHTING) |
|
|
|
#if (SHADERPASS != SHADERPASS_VOLUMETRIC_LIGHTING && !defined(_SURFACE_TYPE_TRANSPARENT)) |
|
|
|
shadow = min(shadow, contactShadow); |
|
|
|
attenuation *= shadow; |
|
|
|
attenuationNoContactShadows = shadow * attenuation; |
|
|
|
attenuation *= min(shadow, contactShadow); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|