Added UtsEvaluateAngelRing;
Added UTSTonemapping;
This commit is contained in:
@@ -9,12 +9,6 @@ struct UtsShadeMask
|
||||
float firstShadeMask;
|
||||
};
|
||||
|
||||
float3 GetSpecularColor(float3 albedo, float metalic)
|
||||
{
|
||||
float3 specColor = lerp(ColorSpaceDielectricSpec.rgb, albedo, metalic);
|
||||
return specColor;
|
||||
}
|
||||
|
||||
float RoughnessToBlinnPhongSpecularExponent(float roughness)
|
||||
{
|
||||
return clamp(2 * rcp(roughness * roughness) - 2, FLT_EPS, rcp(FLT_EPS));
|
||||
@@ -228,6 +222,35 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
|
||||
return lighting;
|
||||
}
|
||||
|
||||
DirectLighting UtsEvaluateAngelRing(FragInputs input, float3 normalWS, float3 V)
|
||||
{
|
||||
DirectLighting lighting;
|
||||
ZERO_INITIALIZE(DirectLighting, lighting);
|
||||
|
||||
// Should we scroll the angel ring texture on x?
|
||||
float3 cameraRight = UNITY_MATRIX_V[0].xyz;
|
||||
float3 cameraFront = UNITY_MATRIX_V[2].xyz;
|
||||
float3 upVector = float3(0, 1, 0);
|
||||
float3 rightAxis = cross(cameraFront, upVector);
|
||||
float cameraRightMagnitude = sqrt(cameraRight.x * cameraRight.x + cameraRight.y * cameraRight.y + cameraRight.z * cameraRight.z);
|
||||
float rightAxisMagnitude = sqrt(rightAxis.x * rightAxis.x + rightAxis.y * rightAxis.y + rightAxis.z * rightAxis.z);
|
||||
float cameraRollCos = dot(rightAxis, cameraRight) / (rightAxisMagnitude * cameraRightMagnitude);
|
||||
float3 cameraRoll = acos(clamp(cameraRollCos, -1.0, 1.0));
|
||||
float cameraDir = cameraRight.y < 0 ? -1.0 : 1.0;
|
||||
|
||||
float2 arOffsetU = lerp(mul(UNITY_MATRIX_V, float4(normalWS, 0)).xyz, float3(0, 0, 1), _AngelRingOffsetU).xy;
|
||||
arOffsetU = arOffsetU * 0.5 + 0.5;
|
||||
float2 arvnRotate = RotateUV(arOffsetU, -(cameraDir * cameraRoll), 0.5, 1.0);
|
||||
float2 arOffsetUV = float2(arvnRotate.x, lerp(input.texCoord0.y, arvnRotate.y, _AngelRingOffsetV));
|
||||
float4 angelRingColor = SAMPLE_TEXTURE2D(_AngelRingColorMap, sampler_AngelRingColorMap, TRANSFORM_TEX(arOffsetUV, _AngelRingColorMap)) * _AngelRingColor * _AngelRingIntensity;
|
||||
|
||||
float weight = saturate(dot(normalize(V), normalWS));
|
||||
|
||||
lighting.specular += angelRingColor.r * angelRingColor.a * weight;
|
||||
|
||||
return lighting;
|
||||
}
|
||||
|
||||
// Todo: SDF nose high light
|
||||
// #if define(_SDFShadow) || define(_SDFNoiseHelight)
|
||||
#ifdef _SDFShadow
|
||||
|
||||
Reference in New Issue
Block a user