This repository has been archived on 2024-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
sota/RunningLateGame/Assets/TerrainSampleAssets/ShaderGraphs/CustomFunctions/CustomLighting.hlsl
Sc0rch-thinks 76b09f88ad game: adding unity packages (1)
added probuilder, terrain tools, terrain asset pack and fbx exporter
2024-07-28 13:16:27 +08:00

32 lines
963 B
HLSL

void MainLight_half(float3 WorldPos, out half3 Dir, out half3 Color, out half DistanceAtten, out half ShadowAtten)
{
#if 1
Dir = half3(0.5, 0.5, 0);
Color = 1;
DistanceAtten = 1;
ShadowAtten = 1;
#else
half4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
Light mainLight = GetMainLight(shadowCoord);
Dir = mainLight.direction;
Color = mainLight.color;
DistanceAtten = mainLight.distanceAttenuation;
ShadowAtten = mainLight.shadowAttenuation;
#endif
Dir = 0;
}
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));
}