Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

OcclusionTestCommon.hlsl 708B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef _OCCLUSION_TEST_COMMON_H
  2. #define _OCCLUSION_TEST_COMMON_H
  3. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  4. float FarthestDepth(float depthA, float depthB)
  5. {
  6. #if UNITY_REVERSED_Z
  7. return min(depthA, depthB);
  8. #else
  9. return max(depthA, depthB);
  10. #endif
  11. }
  12. float FarthestDepth(float4 depths)
  13. {
  14. #if UNITY_REVERSED_Z
  15. return Min3(depths.x, depths.y, min(depths.z, depths.w));
  16. #else
  17. return Max3(depths.x, depths.y, max(depths.z, depths.w));
  18. #endif
  19. }
  20. bool IsVisibleAfterOcclusion(float occluderDepth, float queryClosestDepth)
  21. {
  22. #if UNITY_REVERSED_Z
  23. return queryClosestDepth > occluderDepth;
  24. #else
  25. return queryClosestDepth < occluderDepth;
  26. #endif
  27. }
  28. #endif