mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Bloom (#12791)
Adds configurable light exposure control and bloom effect (light bleeding) with client-side settings.
This commit is contained in:
21
client/shaders/extract_bloom/opengl_fragment.glsl
Normal file
21
client/shaders/extract_bloom/opengl_fragment.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#define rendered texture0
|
||||
|
||||
uniform sampler2D rendered;
|
||||
uniform mediump float exposureFactor = 2.5;
|
||||
uniform float bloomLuminanceThreshold = 1.0;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying mediump vec2 varTexCoord;
|
||||
#else
|
||||
centroid varying vec2 varTexCoord;
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = varTexCoord.st;
|
||||
vec4 color = texture2D(rendered, uv).rgba;
|
||||
// translate to linear colorspace (approximate)
|
||||
color.rgb = pow(color.rgb, vec3(2.2)) * exposureFactor;
|
||||
gl_FragColor = vec4(color.rgb, 1.0); // force full alpha to avoid holes in the image.
|
||||
}
|
11
client/shaders/extract_bloom/opengl_vertex.glsl
Normal file
11
client/shaders/extract_bloom/opengl_vertex.glsl
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user