Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bloom #12791

Merged
merged 25 commits into from
Sep 29, 2022
Merged

Bloom #12791

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
698f4b2
Introduce technical texture names
x2048 Aug 31, 2022
b9eddf5
Add uniform for texture0 texel size
x2048 Aug 31, 2022
2c37ee3
Add multiple texture support to TextureBufferOutput
x2048 Sep 17, 2022
f74b08a
Add box blur shaders
x2048 Aug 31, 2022
830bbed
Add bloom effect
x2048 Aug 31, 2022
b3429ee
TextureBuffer is no longer a RenderTarget
x2048 Sep 17, 2022
254db1b
Use linear color values for all calculations
x2048 Sep 19, 2022
abe8a9d
Apply exposure factor before extracting bloom
x2048 Sep 11, 2022
0cf4e9f
Use downscaled textures for bloom
x2048 Sep 17, 2022
fd8f9f7
Add user configuration for exposure
x2048 Sep 18, 2022
348afac
Add parameter to control bloom effect
x2048 Sep 18, 2022
236700e
Add parameters for bloom threshold and boost
x2048 Sep 19, 2022
d1ba786
Replace bloom boost with bloom intensity parameter
x2048 Sep 19, 2022
5c4b14e
Add a parameter for bloom radius
x2048 Sep 19, 2022
0a8c9b6
Change blur equation for more realistic bloom at large kernels
x2048 Sep 19, 2022
bd4405b
Implement physically based bloom
x2048 Sep 20, 2022
9f87010
Compensate exposure when tonemapping is off
x2048 Sep 20, 2022
9aa1cbe
Use fixed value for exposure compensation
x2048 Sep 20, 2022
31d88fa
Fix documentation for bloom parameters
x2048 Sep 21, 2022
9989516
Clamp color values before applying gamma
x2048 Sep 22, 2022
a9fbc73
Add bloom debugging setting
x2048 Sep 24, 2022
56e9f3d
Use medium precision in blur shaders
x2048 Sep 24, 2022
082dfd4
Add flag to use dedicated texture in bloom
x2048 Sep 24, 2022
cc46fab
Document correct default value for bloom_intensity
x2048 Sep 25, 2022
133f102
Align style of doxygen comments
x2048 Sep 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use medium precision in blur shaders
To avoid artifacts on low-profile systems
  • Loading branch information
x2048 committed Sep 24, 2022
commit 56e9f3df9b269cd92557c837938142d6dc559867
10 changes: 5 additions & 5 deletions client/shaders/blur_h/opengl_fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

uniform sampler2D rendered;
uniform vec2 texelSize0;
uniform lowp float bloomRadius = 3.0;
uniform mediump float bloomRadius = 3.0;

#ifdef GL_ES
varying mediump vec2 varTexCoord;
Expand All @@ -13,13 +13,13 @@ centroid varying vec2 varTexCoord;
void main(void)
{
// kernel distance and linear size
lowp float n = 2. * bloomRadius + 1.;
mediump float n = 2. * bloomRadius + 1.;

vec2 uv = varTexCoord.st - vec2(bloomRadius * texelSize0.x, 0.);
vec4 color = vec4(0.);
lowp float sum = 0.;
for (lowp float i = 0.; i < n; i++) {
lowp float weight = pow(1. - (abs(i / bloomRadius - 1.)), 1.3);
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.);
Expand Down
10 changes: 5 additions & 5 deletions client/shaders/blur_v/opengl_fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

uniform sampler2D rendered;
uniform vec2 texelSize0;
uniform lowp float bloomRadius = 3.0;
uniform mediump float bloomRadius = 3.0;

#ifdef GL_ES
varying mediump vec2 varTexCoord;
Expand All @@ -13,13 +13,13 @@ centroid varying vec2 varTexCoord;
void main(void)
x2048 marked this conversation as resolved.
Show resolved Hide resolved
{
// kernel distance and linear size
lowp float n = 2. * bloomRadius + 1.;
mediump float n = 2. * bloomRadius + 1.;

vec2 uv = varTexCoord.st - vec2(0., bloomRadius * texelSize0.y);
vec4 color = vec4(0.);
lowp float sum = 0.;
for (lowp float i = 0.; i < n; i++) {
lowp float weight = pow(1. - (abs(i / bloomRadius - 1.)), 1.3);
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(0., texelSize0.y);
Expand Down