PPEyeAdaptationBasicSetup.bsl 707 B

123456789101112131415161718192021222324252627282930
  1. #include "$ENGINE$\PPBase.bslinc"
  2. #include "$ENGINE$\PPEyeAdaptationCommon.bslinc"
  3. technique PPEyeAdaptationBasicSetup
  4. {
  5. mixin PPBase;
  6. mixin PPEyeAdaptationParams;
  7. code
  8. {
  9. Texture2D gInputTex;
  10. [alias(gInputTex)]
  11. SamplerState gInputSamp;
  12. float4 fsmain(VStoFS input) : SV_Target0
  13. {
  14. float4 value = gInputTex.Sample(gInputSamp, input.uv0);
  15. float luminance = dot(value.xyz, float3(0.2126, 0.7152, 0.0722));
  16. float maxIntensity = gEyeAdaptationParams[2].z;
  17. luminance = max(maxIntensity, luminance);
  18. // Store intensity as log, and scale to [0, 1] range
  19. value.w = gEyeAdaptationParams[0].x * log2(luminance) + gEyeAdaptationParams[0].y;
  20. return value;
  21. }
  22. };
  23. };