Added UTSAPI

This commit is contained in:
2025-05-21 17:02:07 +09:00
parent 35dc7b15a6
commit 59b46bce44
9 changed files with 147 additions and 69 deletions

View File

@@ -108,7 +108,7 @@ half3 FitWithCurveApprox(half NdotL, half Curvature)
return lerp(curve0, curve1, mad(oneMinusCurva2, -1.0 * oneMinusCurva2, 1.0));
}
DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, PreLightData preLightData, SHADOW_TYPE shadow,
DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, PreLightData preLightData, SHADOW_TYPE shadow,
float3 lightColor, float3 V, float3 L, float2 uv,
float diffuseDimmer, float specularDimmer)
{
@@ -117,7 +117,8 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
if (Max3(lightColor.r, lightColor.g, lightColor.b) > 0.0)
{
SHADOW_TYPE sharpShadow = smoothstep(0.4, 0.6, shadow);
// SHADOW_TYPE sharpShadow = smoothstep(0.4, 0.6, shadow);
SHADOW_TYPE sharpShadow = shadow;
#if _RECEIVE_HAIR_SHADOW_ON && ENABLE_UTS_HAIR_SHAOW
sharpShadow *= GetHairShadow(posInput, L);
#endif
@@ -143,7 +144,7 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
float NdotL = dot(bsdfData.normalWS, L);
float halfLambert = 0.5 * NdotL + 0.5;
float3 rampColor = SAMPLE_TEXTURE2D_ARRAY(_ShadingRampMap, s_linear_clamp_sampler, float2(halfLambert * shadow.x, rampMask), _ShadingIndex).rgb;
float3 rampColor = SAMPLE_TEXTURE2D_ARRAY(_ShadingRampMap, s_linear_clamp_sampler, float2(halfLambert * sharpShadow.x, rampMask), _ShadingIndex).rgb;
diffuseTerm = bsdfData.diffuseColor * rampColor * INV_PI;
specularTerm *= saturate(NdotL) * sharpShadow;
@@ -187,6 +188,8 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
lighting.specular += rimLightLighting.specular;
}
#endif
// lighting.diffuse = sharpShadow;
}
return lighting;