2022-09-29 20:34:05 +02:00
|
|
|
#define rendered texture0
|
|
|
|
|
2023-01-06 22:33:25 +01:00
|
|
|
struct ExposureParams {
|
|
|
|
float compensationFactor;
|
|
|
|
};
|
|
|
|
|
2022-09-29 20:34:05 +02:00
|
|
|
uniform sampler2D rendered;
|
2022-11-02 09:09:48 +01:00
|
|
|
uniform mediump float bloomStrength;
|
2023-01-06 22:33:25 +01:00
|
|
|
uniform ExposureParams exposureParams;
|
2022-09-29 20:34:05 +02:00
|
|
|
|
|
|
|
#ifdef GL_ES
|
|
|
|
varying mediump vec2 varTexCoord;
|
|
|
|
#else
|
|
|
|
centroid varying vec2 varTexCoord;
|
|
|
|
#endif
|
|
|
|
|
2023-01-06 22:33:25 +01:00
|
|
|
varying float exposure;
|
2022-09-29 20:34:05 +02:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
vec2 uv = varTexCoord.st;
|
2022-11-02 09:09:48 +01:00
|
|
|
vec3 color = texture2D(rendered, uv).rgb;
|
2022-09-29 20:34:05 +02:00
|
|
|
// translate to linear colorspace (approximate)
|
2022-11-02 09:09:48 +01:00
|
|
|
color = pow(color, vec3(2.2));
|
|
|
|
|
2023-01-06 22:33:25 +01:00
|
|
|
color *= pow(2., exposure) * exposureParams.compensationFactor * bloomStrength;
|
2022-11-02 09:09:48 +01:00
|
|
|
gl_FragColor = vec4(color, 1.0); // force full alpha to avoid holes in the image.
|
2022-09-29 20:34:05 +02:00
|
|
|
}
|