diff --git a/Effects/bloom-blur-1.eff b/Effects/bloom-blur-1.eff
new file mode 100644
index 000000000..2e5f259f5
--- /dev/null
+++ b/Effects/bloom-blur-1.eff
@@ -0,0 +1,10 @@
+
+
+ Effects/bloom-blur-1
+ Effects/blur
+
+ 4.0
+ 0.0
+ bloom-1
+
+
diff --git a/Effects/bloom-blur-2.eff b/Effects/bloom-blur-2.eff
new file mode 100644
index 000000000..a764658b6
--- /dev/null
+++ b/Effects/bloom-blur-2.eff
@@ -0,0 +1,10 @@
+
+
+ Effects/bloom-blur-2
+ Effects/blur
+
+ 0.0
+ 4.0
+ bloom-2
+
+
diff --git a/Effects/bloom-combine.eff b/Effects/bloom-combine.eff
new file mode 100644
index 000000000..d07a5b242
--- /dev/null
+++ b/Effects/bloom-combine.eff
@@ -0,0 +1,34 @@
+
+
+ Effects/bloom-combine
+
+
+
+
+
+ 0
+ buffer
+ spec-emis
+
+
+ 1
+ buffer
+ diffuse
+
+
+ Shaders/fullscreen.vert
+ Shaders/bloom-combine.frag
+
+
+ spec_emis_tex
+ sampler-2d
+ 0
+
+
+ color_tex
+ sampler-2d
+ 1
+
+
+
+
diff --git a/Effects/default-pipeline.xml b/Effects/default-pipeline.xml
index e7d4d4ff1..64c6feb58 100644
--- a/Effects/default-pipeline.xml
+++ b/Effects/default-pipeline.xml
@@ -124,6 +124,45 @@
1.0
clamp-to-border
+
+ bloom-1
+
+ /sim/rendering/rembrandt/bloom-buffers
+
+ rgba8
+ rgba
+ unsigned-byte
+ screen
+ screen
+ 0.25
+ clamp-to-border
+
+
+ bloom-2
+
+ /sim/rendering/rembrandt/bloom-buffers
+
+ rgba8
+ rgba
+ unsigned-byte
+ screen
+ screen
+ 0.25
+ clamp-to-border
+
+
+ bloom-3
+
+ /sim/rendering/rembrandt/bloom-buffers
+
+ rgba8
+ rgba
+ unsigned-byte
+ screen
+ screen
+ 0.25
+ clamp-to-border
+
@@ -209,6 +248,50 @@
lighting
+
+
+ bloom-1
+ fullscreen
+
+ /sim/rendering/rembrandt/bloom-buffers
+
+ 60
+ Effects/bloom-combine
+ 0.25
+
+ color0
+ bloom-1
+
+
+
+ bloom-2
+ fullscreen
+
+ /sim/rendering/rembrandt/bloom-buffers
+
+ 61
+ Effects/bloom-blur-1
+ 0.25
+
+ color0
+ bloom-2
+
+
+
+ bloom-3
+ fullscreen
+
+ /sim/rendering/rembrandt/bloom-buffers
+
+ 62
+ Effects/bloom-blur-2
+ 0.25
+
+ color0
+ bloom-3
+
+
+
display
99
diff --git a/Effects/display.eff b/Effects/display.eff
index 898f15fbd..a6af6c4ee 100644
--- a/Effects/display.eff
+++ b/Effects/display.eff
@@ -5,6 +5,7 @@
+
@@ -40,7 +41,7 @@
5
buffer
- ao-3
+ bloom-3
Shaders/fullscreen.vert
@@ -72,7 +73,7 @@
4
- ao_tex
+ bloom_tex
sampler-2d
5
@@ -91,6 +92,11 @@
bool
+
+ bloomEnabled
+ bool
+
+
diff --git a/Shaders/bloom-combine.frag b/Shaders/bloom-combine.frag
new file mode 100644
index 000000000..4e9dcef09
--- /dev/null
+++ b/Shaders/bloom-combine.frag
@@ -0,0 +1,10 @@
+uniform sampler2D color_tex;
+uniform sampler2D spec_emis_tex;
+void main() {
+ vec2 coords = gl_TexCoord[0].xy;
+ vec4 spec_emis = texture2D( spec_emis_tex, coords );
+ if ( spec_emis.a < 0.1 )
+ spec_emis.z = 0.0;
+ vec3 tcolor = texture2D( color_tex, coords ).rgb;
+ gl_FragColor = vec4(tcolor * spec_emis.z, 1.0);
+}
diff --git a/Shaders/display.frag b/Shaders/display.frag
index 298fab549..4bd6b7aa2 100644
--- a/Shaders/display.frag
+++ b/Shaders/display.frag
@@ -3,12 +3,13 @@ uniform sampler2D normal_tex;
uniform sampler2D color_tex;
uniform sampler2D specular_tex;
uniform sampler2D lighting_tex;
-//uniform sampler2D bloom_tex;
+uniform sampler2D bloom_tex;
uniform sampler2D ao_tex;
uniform float exposure;
uniform bool showBuffers;
uniform bool fg_DepthInColor;
uniform bool ambientOcclusion;
+uniform bool bloomEnabled;
vec3 HDR(vec3 L) {
L = L * exposure;
@@ -33,11 +34,15 @@ void main() {
} else if (coords.x < 0.2 && coords.y >= 0.8 && ambientOcclusion) {
color = texture2D( ao_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
} else {
- color = texture2D( lighting_tex, coords ) /* + texture2D( bloom_tex, coords ) */;
+ color = texture2D( lighting_tex, coords );
+ if (bloomEnabled)
+ color = color + texture2D( bloom_tex, coords );
//color = vec4( HDR( color.rgb ), 1.0 );
}
} else {
- color = texture2D( lighting_tex, coords ) /* + texture2D( bloom_tex, coords ) */;
+ color = texture2D( lighting_tex, coords );
+ if (bloomEnabled)
+ color = color + texture2D( bloom_tex, coords );
//color = vec4( HDR( color.rgb ), 1.0 );
}
gl_FragColor = color;
diff --git a/preferences.xml b/preferences.xml
index 1542e4ea7..54b643c3d 100644
--- a/preferences.xml
+++ b/preferences.xml
@@ -70,6 +70,8 @@ Started September 2000 by David Megginson, david@megginson.com
false
false
true
+ true
+ true
1.0
false
false