CustomLighting.hlsl 746 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. void MainLight_half(float3 WorldPos, out half3 Direction, out half3 Color, out half DistanceAtten, out half ShadowAtten,out half3 SkyColor)
  2. {
  3. #if SHADERGRAPH_PREVIEW
  4. Direction = half3(0.5, 0.5, 0);
  5. SkyColor=0;
  6. Color = 1;
  7. DistanceAtten = 1;
  8. ShadowAtten = 1;
  9. #else
  10. #if SHADOWS_SCREEN
  11. half4 clipPos = TransformWorldToHClip(WorldPos);
  12. half4 shadowCoord = ComputeScreenPos(clipPos);
  13. #else
  14. half4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
  15. #endif
  16. Light mainLight = GetMainLight(shadowCoord);
  17. Direction = mainLight.direction;
  18. Color = mainLight.color;
  19. SkyColor=SHADERGRAPH_AMBIENT_SKY;
  20. DistanceAtten = mainLight.distanceAttenuation;
  21. ShadowAtten = mainLight.shadowAttenuation;
  22. #endif
  23. }