Added UTSAPI
This commit is contained in:
@@ -19,25 +19,6 @@ int eAngelRing = 4;
|
||||
int eRimLight = 5;
|
||||
int eOutline = 6;
|
||||
|
||||
int GetNextDirectionalLightIndex(BuiltinData builtinData, int currentIndex, int mainLightIndex)
|
||||
{
|
||||
int i = 0; // Declare once to avoid the D3D11 compiler warning.
|
||||
for (i = 0; i < (int)_DirectionalLightCount; ++i)
|
||||
{
|
||||
if (IsMatchingLightLayer(_DirectionalLightDatas[i].lightLayers, builtinData.renderingLayers))
|
||||
{
|
||||
if (mainLightIndex != i)
|
||||
{
|
||||
if (currentIndex < i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1; // not found
|
||||
}
|
||||
|
||||
bool UtsUseScreenSpaceShadow(DirectionalLightData light, float3 normalWS)
|
||||
{
|
||||
#if defined(RAY_TRACED_SCREEN_SPACE_SHADOW_FLAG)
|
||||
@@ -50,18 +31,7 @@ bool UtsUseScreenSpaceShadow(DirectionalLightData light, float3 normalWS)
|
||||
return (validScreenSpaceShadow && ((rayTracedShadow && visibleLight) || !rayTracedShadow));
|
||||
#else
|
||||
return ((light.screenSpaceShadowIndex & SCREEN_SPACE_SHADOW_INDEX_MASK) != INVALID_SCREEN_SPACE_SHADOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsNonZeroBSDF(float3 L, UtsBSDFData bsdfData)
|
||||
{
|
||||
#if _MATERIAL_TYPE_FACE
|
||||
return true;
|
||||
#else
|
||||
float NdotL = dot(bsdfData.normalWS, L);
|
||||
|
||||
return NdotL > 0.0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bsdfData, BuiltinData builtinData,
|
||||
@@ -99,7 +69,7 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
|
||||
|
||||
// Is it worth sampling the shadow map?
|
||||
// Should we skip it if NdotL is negative? (i.e. transmission)
|
||||
if ((light.lightDimmer > 0) && (light.shadowDimmer > 0))
|
||||
if ((light.lightDimmer > 0) && (light.shadowDimmer > 0) && IsNonZeroBSDF(L, bsdfData))
|
||||
{
|
||||
context.shadowValue = GetDirectionalShadowAttenuation(context.shadowContext,
|
||||
posInput.positionSS, posInput.positionWS + L * _ShadowDistanceBias, UtsGetShadowNormal(bsdfData),
|
||||
|
||||
Reference in New Issue
Block a user