1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-26 18:21:04 +00:00
Adds configurable light exposure control and bloom effect (light bleeding) with client-side settings.
This commit is contained in:
x2048 2022-09-29 20:34:05 +02:00 committed by GitHub
parent 3978b9b8ed
commit 9df79a4b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 422 additions and 118 deletions

View file

@ -0,0 +1,29 @@
#define rendered texture0
uniform sampler2D rendered;
uniform vec2 texelSize0;
uniform mediump float bloomRadius = 3.0;
#ifdef GL_ES
varying mediump vec2 varTexCoord;
#else
centroid varying vec2 varTexCoord;
#endif
void main(void)
{
// kernel distance and linear size
mediump float n = 2. * bloomRadius + 1.;
vec2 uv = varTexCoord.st - vec2(bloomRadius * texelSize0.x, 0.);
vec4 color = vec4(0.);
mediump float sum = 0.;
for (mediump float i = 0.; i < n; i++) {
mediump float weight = pow(1. - (abs(i / bloomRadius - 1.)), 1.3);
color += texture2D(rendered, uv).rgba * weight;
sum += weight;
uv += vec2(texelSize0.x, 0.);
}
color /= sum;
gl_FragColor = vec4(color.rgb, 1.0); // force full alpha to avoid holes in the image.
}

View file

@ -0,0 +1,11 @@
#ifdef GL_ES
varying mediump vec2 varTexCoord;
#else
centroid varying vec2 varTexCoord;
#endif
void main(void)
{
varTexCoord.st = inTexCoord0.st;
gl_Position = inVertexPosition;
}