2022-07-23 03:41:08 +00:00
|
|
|
#version 120
|
|
|
|
|
2023-02-25 19:03:39 +00:00
|
|
|
#include "lib/luminance/constants.glsl"
|
|
|
|
|
2022-07-23 03:41:08 +00:00
|
|
|
varying vec2 uv;
|
|
|
|
uniform sampler2D luminanceSceneTex;
|
|
|
|
uniform sampler2D prevLuminanceSceneTex;
|
|
|
|
|
|
|
|
uniform float osg_DeltaFrameTime;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
float prevLum = texture2D(prevLuminanceSceneTex, vec2(0.5, 0.5)).r;
|
|
|
|
float currLum = texture2D(luminanceSceneTex, vec2(0.5, 0.5)).r;
|
|
|
|
|
2023-02-25 19:03:39 +00:00
|
|
|
float avgLum = exp2((currLum * logLumRange) + minLog);
|
|
|
|
gl_FragColor.r = prevLum + (avgLum - prevLum) * (1.0 - exp(-osg_DeltaFrameTime * hdrExposureTime));
|
2022-07-23 03:41:08 +00:00
|
|
|
}
|