您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
34 行
993 B
34 行
993 B
|
|
|
|
|
|
void MainLight_half(float3 WorldPos, out half3 Direction, out half3 Color, out half DistanceAtten, out half ShadowAtten)
|
|
{
|
|
#ifdef SHADERGRAPH_PREVIEW
|
|
Direction = half3(0.5, 0.5, 0);
|
|
Color = 1;
|
|
DistanceAtten = 1;
|
|
ShadowAtten = 1;
|
|
#else
|
|
half4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
|
|
Light mainLight = GetMainLight(shadowCoord);
|
|
Direction = mainLight.direction;
|
|
Color = mainLight.color;
|
|
DistanceAtten = mainLight.distanceAttenuation;
|
|
ShadowAtten = mainLight.shadowAttenuation;
|
|
#endif
|
|
}
|
|
|
|
void SampleSH_half(half3 normalWS, out half3 Ambient)
|
|
{
|
|
// LPPV is not supported in Ligthweight Pipeline
|
|
real4 SHCoefficients[7];
|
|
SHCoefficients[0] = unity_SHAr;
|
|
SHCoefficients[1] = unity_SHAg;
|
|
SHCoefficients[2] = unity_SHAb;
|
|
SHCoefficients[3] = unity_SHBr;
|
|
SHCoefficients[4] = unity_SHBg;
|
|
SHCoefficients[5] = unity_SHBb;
|
|
SHCoefficients[6] = unity_SHC;
|
|
|
|
Ambient = max(half3(0, 0, 0), SampleSH9(SHCoefficients, normalWS));
|
|
}
|