You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
695 B

  1. #ifndef __EYE_ADAPTATION__
  2. #define __EYE_ADAPTATION__
  3. // Optimal values for PS4/GCN
  4. // Using a group size of 32x32 seems to be a bit faster on Kepler/Maxwell
  5. // Don't forget to update 'EyeAdaptationController.cs' if you change these values !
  6. #define HISTOGRAM_BINS 64
  7. #define HISTOGRAM_TEXELS HISTOGRAM_BINS / 4
  8. #define HISTOGRAM_THREAD_X 16
  9. #define HISTOGRAM_THREAD_Y 16
  10. float GetHistogramBinFromLuminance(float value, float2 scaleOffset)
  11. {
  12. return saturate(log2(value) * scaleOffset.x + scaleOffset.y);
  13. }
  14. float GetLuminanceFromHistogramBin(float bin, float2 scaleOffset)
  15. {
  16. return exp2((bin - scaleOffset.y) / scaleOffset.x);
  17. }
  18. #endif // __EYE_ADAPTATION__