Added GT Toon map;
Changed shadow bias from fixed to slope based;
This commit is contained in:
@@ -10,6 +10,15 @@ float3 UtsGetShadowNormal(UtsBSDFData bsdfData)
|
||||
#endif
|
||||
}
|
||||
|
||||
float UtsGetShadowSlopeBias(float3 N, float3 L)
|
||||
{
|
||||
// The slope bias is used to avoid shadow acne.
|
||||
// It is calculated based on the angle between the normal and the light direction.
|
||||
// The more perpendicular the light is to the surface, the more bias we apply.
|
||||
float NdotL = dot(N, L);
|
||||
return (1.0 - NdotL) * _ShadowDistanceBias;
|
||||
}
|
||||
|
||||
float3 SampleSDFTexture(float3 L, float2 uv, out float angle)
|
||||
{
|
||||
float2 right_uv = float2(1 - uv.x, uv.y);
|
||||
@@ -81,7 +90,7 @@ SHADOW_TYPE UtsEvaluateShadow_Punctual(LightLoopContext lightLoopContext, Positi
|
||||
#endif
|
||||
if ((light.shadowIndex >= 0) && (light.shadowDimmer > 0) && IsNonZeroBSDF(L, N))
|
||||
{
|
||||
shadow = GetPunctualShadowAttenuation(lightLoopContext.shadowContext, posInput.positionSS, posInput.positionWS + L * _ShadowDistanceBias, N, light.shadowIndex, L, distances.x, light.lightType == GPULIGHTTYPE_POINT, light.lightType != GPULIGHTTYPE_PROJECTOR_BOX);
|
||||
shadow = GetPunctualShadowAttenuation(lightLoopContext.shadowContext, posInput.positionSS, posInput.positionWS + L * UtsGetShadowSlopeBias(N, L), N, light.shadowIndex, L, distances.x, light.lightType == GPULIGHTTYPE_POINT, light.lightType != GPULIGHTTYPE_PROJECTOR_BOX);
|
||||
|
||||
#ifdef SHADOWS_SHADOWMASK
|
||||
// Note: Legacy Unity have two shadow mask mode. ShadowMask (ShadowMask contain static objects shadow and ShadowMap contain only dynamic objects shadow, final result is the minimun of both value)
|
||||
|
||||
Reference in New Issue
Block a user