diff --git a/SMCode/SM.Base/PostEffects/BloomEffect.cs b/SMCode/SM.Base/PostEffects/BloomEffect.cs
index f5926ca..be90afd 100644
--- a/SMCode/SM.Base/PostEffects/BloomEffect.cs
+++ b/SMCode/SM.Base/PostEffects/BloomEffect.cs
@@ -77,6 +77,12 @@ namespace SM.Base.PostEffects
///
public float Power = 1;
+ ///
+ /// Radius of the effect
+ /// Default: 2
+ ///
+ public float Radius = 2;
+
///
/// This can disable the bloom calculation.
/// Default: true
@@ -175,6 +181,8 @@ namespace SM.Base.PostEffects
collection["Weights"].SetUniform1(_weights);
collection["WeightCount"].SetUniform1(WeightCurvePickAmount);
collection["Power"].SetUniform1(Power);
+
+ collection["Radius"].SetUniform1(_textureScale * Radius);
});
hoz = !hoz;
diff --git a/SMCode/SM.Base/PostEffects/Shaders/bloom_blur.glsl b/SMCode/SM.Base/PostEffects/Shaders/bloom_blur.glsl
index 0393f55..4943dd6 100644
--- a/SMCode/SM.Base/PostEffects/Shaders/bloom_blur.glsl
+++ b/SMCode/SM.Base/PostEffects/Shaders/bloom_blur.glsl
@@ -13,6 +13,8 @@ uniform float[32] Weights;
uniform int WeightCount;
uniform float Power;
+uniform float Radius;
+
layout(location = 0) out vec4 color;
vec4 GetRenderColorOffset(vec2 offset);
@@ -37,8 +39,8 @@ void main() {
result *= GetWeight(0);
for(int i = 1; i < WeightCount; i++) {
- result += max(GetRenderColorOffset(tex_offset * i).rgb - thres, 0) * (First ? Power : 1) * GetWeight(i);
- result += max(GetRenderColorOffset(-tex_offset * i).rgb - thres, 0) * (First ? Power : 1) * GetWeight(i);
+ result += max(GetRenderColorOffset(tex_offset * i * Radius).rgb - thres, 0) * (First ? Power : 1) * GetWeight(i);
+ result += max(GetRenderColorOffset(-tex_offset * i * Radius).rgb - thres, 0) * (First ? Power : 1) * GetWeight(i);
}
color = vec4(result, 1);
diff --git a/SM_TEST/Program.cs b/SM_TEST/Program.cs
index 6fc29b1..3e49a51 100644
--- a/SM_TEST/Program.cs
+++ b/SM_TEST/Program.cs
@@ -23,8 +23,11 @@ namespace SM_TEST
{
window = new GLWindow();
window.ApplySetup(new Window2DSetup());
+ window.SetRenderPipeline(new TestRenderPipeline());
+
window.SetScene(scene = new Scene());
scene.Objects.Add(new DrawObject2D());
+
window.UpdateFrame += WindowOnUpdateFrame;
window.Run();
diff --git a/SM_TEST/TestRenderPipeline.cs b/SM_TEST/TestRenderPipeline.cs
index 8ce9791..cde2f5b 100644
--- a/SM_TEST/TestRenderPipeline.cs
+++ b/SM_TEST/TestRenderPipeline.cs
@@ -18,9 +18,10 @@ namespace SM_TEST
_postBuffer = CreateWindowFramebuffer(0);
Framebuffers.Add(_postBuffer);
- _bloom = new BloomEffect(MainFramebuffer, hdr: true, .75f)
+ _bloom = new BloomEffect(MainFramebuffer, hdr: true, .5f)
{
Threshold = .5f,
+ Radius = 5
};