"#include \"AtmosphereShadersCommon.fxh\"\n" "\n" "#if LIGHT_ADAPTATION\n" "cbuffer cbMiscDynamicParams\n" "{\n" " MiscDynamicParams g_MiscParams;\n" "}\n" "#endif\n" "\n" "Texture2D g_tex2DLowResLuminance;\n" "\n" "void UpdateAverageLuminancePS( FullScreenTriangleVSOutput VSOut, \n" " // We must declare vertex shader output even though we \n" " // do not use it, because otherwise the shader will not\n" " // run on NVidia GLES\n" " out float4 f4Luminance : SV_Target)\n" "{\n" "#if LIGHT_ADAPTATION\n" " const float fAdaptationRate = 1.0;\n" " float fNewLuminanceWeight = 1.0 - exp( - fAdaptationRate * g_MiscParams.fElapsedTime );\n" "#else\n" " float fNewLuminanceWeight = 1.0;\n" "#endif\n" " float2 LogLum_W = g_tex2DLowResLuminance.Load( int3(0,0,LOW_RES_LUMINANCE_MIPS-1) );\n" " float LogLum = LogLum_W.x / max(LogLum_W.y, 1e-6);\n" " fNewLuminanceWeight *= saturate(LogLum_W.y / 1e-3);\n" "\n" " f4Luminance = float4( exp(LogLum), 0.0, 0.0, fNewLuminanceWeight );\n" "}\n"