Firstborn/Assets/Daz3D/Shaders/UnofficialDTU/GetLightDirectionURP.hlsl
Schaken-Mods 959e80cf72 assets upload
assets upload description.
2023-03-28 12:16:30 -05:00

23 lines
574 B
HLSL

//////////////////////////////
//
// Code based on tutorial by Daniel Ilett
// https://danielilett.com/2020-03-21-tut5-urp-cel-shading/
//
//////////////////////////////
void MainLight_half(float3 WorldPos, out half3 Direction)
{
#if SHADERGRAPH_PREVIEW
Direction = half3(0.5, 0.5, 0);
#else
#if SHADOWS_SCREEN
half4 clipPos = TransformWorldToHClip(WorldPos);
half4 shadowCoord = ComputeScreenPos(clipPos);
#else
half4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
#endif
Light mainLight = GetMainLight(shadowCoord);
Direction = mainLight.direction;
#endif
}