您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
26 行
976 B
26 行
976 B
#if SHADERPASS != SHADERPASS_FORWARD
|
|
#error SHADERPASS_is_not_correctly_define
|
|
#endif
|
|
|
|
float4 Frag(PackedVaryings packedInput) : SV_Target
|
|
{
|
|
FragInput input = UnpackVaryings(packedInput);
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
|
float3 positionWS = input.positionWS;
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData(input, surfaceData, builtinData);
|
|
|
|
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
|
|
Coordinate coord = GetCoordinate(input.unPositionSS.xy, _ScreenSize.zw);
|
|
PreLightData preLightData = GetPreLightData(V, positionWS, coord, bsdfData);
|
|
|
|
float3 diffuseLighting;
|
|
float3 specularLighting;
|
|
float3 bakeDiffuseLighting = GetBakedDiffuseLigthing(surfaceData, builtinData, bsdfData, preLightData);
|
|
LightLoop(V, positionWS, coord, preLightData, bsdfData, bakeDiffuseLighting, diffuseLighting, specularLighting);
|
|
|
|
return float4(diffuseLighting + specularLighting, builtinData.opacity);
|
|
}
|
|
|