Added new stocking scope to shader gui;
Added new stocking surface feature; Added unity 6.3 support; Fixed the issue that ssr weight does not blend ibl and ssr properly; Fixed the issue that material recive ssr regardless of specular ambient mode;
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
#ifndef UTS_SURFACE_FEATURE_EVALUATION
|
||||
#define UTS_SURFACE_FEATURE_EVALUATION
|
||||
|
||||
void UtsEvaluateLighting_Stocking(FragInputs input, PositionInputs posInput, float3 normalWS, float3 V, inout AggregateLighting aggregateLighting)
|
||||
void UtsEvaluateLighting_Stocking(FragInputs input, PositionInputs posInput, PreLightData preLightData, float3 N, float3 V, inout AggregateLighting aggregateLighting)
|
||||
{
|
||||
float NdotV = saturate(dot(normalize(V), normalWS));
|
||||
float fresnel = pow(preLightData.NdotV, _StockingFresnelWidth);
|
||||
|
||||
NdotV = pow(NdotV, 2.0);
|
||||
#if _STOCKING_SPARKING_MAP
|
||||
float viewAngleFactor = saturate(1.0 - preLightData.NdotV);
|
||||
float2 shiftedNDC = posInput.positionNDC.xy + viewAngleFactor * 0.05;
|
||||
float spacing = (1.0 - posInput.linearDepth) * _StockingSparkleSpacing;
|
||||
|
||||
// TODO: Move sparkle to bsdf evaluation?
|
||||
// float sparkle = Random(posInput.positionNDC.xy);
|
||||
// sparkle = step(0.995, sparkle);
|
||||
// float noise = SimpleNoise(posInput.positionNDC.xy, 500.0);
|
||||
// sparkle = noise < sparkle ? 1.0 : 0.0;
|
||||
// NOTE: Should we use sparkle texture instead of Voronoi?
|
||||
float screenSparkle = smoothstep(1.0 - (0.5 * _StockingSparkleAmount), 1, 1.0 - Voronoi(shiftedNDC * _ScreenParams.xy / spacing, 5, 5.0));
|
||||
float objectSparkle = smoothstep(1.0 - (0.5 * _StockingSparkleSize), 1, 1.0 - Voronoi(input.texCoord0, 5, 100.0));
|
||||
float sparkle = objectSparkle * screenSparkle * _StockingSparkleIntensity * 5;
|
||||
aggregateLighting.direct.specular += sparkle * aggregateLighting.direct.specular;
|
||||
#endif
|
||||
|
||||
aggregateLighting.direct.diffuse *= NdotV;
|
||||
// aggregateLighting.direct.specular = saturate(aggregateLighting.direct.specular + sparkle * (1.0 - NdotV) * 0.5);
|
||||
aggregateLighting.direct.diffuse *= fresnel;
|
||||
}
|
||||
|
||||
DirectLighting UtsEvaluateLighting_RimLight(PositionInputs posInput, UtsBSDFData bsdfData, PreLightData preLightData
|
||||
|
||||
Reference in New Issue
Block a user