29 lines
1.1 KiB
HLSL
29 lines
1.1 KiB
HLSL
PackedVaryings vert(Attributes input)
|
|
{
|
|
Varyings output = (Varyings)0;
|
|
output = BuildVaryings(input);
|
|
PackedVaryings packedOutput = PackVaryings(output);
|
|
return packedOutput;
|
|
}
|
|
|
|
half4 frag(PackedVaryings packedInput) : SV_TARGET
|
|
{
|
|
Varyings unpacked = UnpackVaryings(packedInput);
|
|
UNITY_SETUP_INSTANCE_ID(unpacked);
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(unpacked);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
half crossSign = (unpacked.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
|
|
half3 bitangent = crossSign * cross(unpacked.normalWS.xyz, unpacked.tangentWS.xyz);
|
|
|
|
#ifdef UNIVERSAL_USELEGACYSPRITEBLOCKS
|
|
half4 color = surfaceDescription.SpriteColor;
|
|
#else
|
|
half4 color = half4(surfaceDescription.BaseColor, surfaceDescription.Alpha);
|
|
#endif
|
|
|
|
return NormalsRenderingShared(color, surfaceDescription.NormalTS, unpacked.tangentWS.xyz, bitangent, unpacked.normalWS);
|
|
}
|