Fragment brightness has now a effect on the radius
This commit is contained in:
parent
ddd2171da2
commit
9fa1ac6ad9
3 changed files with 9 additions and 8 deletions
|
|
@ -81,7 +81,7 @@ namespace SM.Base.PostEffects
|
||||||
/// Radius of the effect
|
/// Radius of the effect
|
||||||
/// <para>Default: 2</para>
|
/// <para>Default: 2</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Radius = 2;
|
public float Radius = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This can disable the bloom calculation.
|
/// This can disable the bloom calculation.
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,13 @@ void main() {
|
||||||
|
|
||||||
vec2 tex_offset = 1.0 / textureSize(renderedTexture, 0) * vec2(Horizontal ? 1 : 0, Horizontal ? 0 : 1);
|
vec2 tex_offset = 1.0 / textureSize(renderedTexture, 0) * vec2(Horizontal ? 1 : 0, Horizontal ? 0 : 1);
|
||||||
|
|
||||||
vec3 result = max(GetRenderColorOffset(vec2(0)).rgb - thres, 0) * (First ? Power : 1);
|
vec3 result = max(GetRenderColorOffset(vec2(0)).rgb - thres, 0) * (First ? Power : 1) * GetWeight(0);
|
||||||
result *= GetWeight(0);
|
|
||||||
|
float radi = Radius + (length(result));
|
||||||
|
|
||||||
for(int i = 1; i < WeightCount; i++) {
|
for(int i = 1; i < WeightCount; i++) {
|
||||||
result += max(GetRenderColorOffset(tex_offset * i * Radius).rgb - thres, 0) * (First ? Power : 1) * GetWeight(i);
|
result += max(GetRenderColorOffset(tex_offset * i * radi).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 * radi).rgb - thres, 0) * (First ? Power : 1) * GetWeight(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
color = vec4(result, 1);
|
color = vec4(result, 1);
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ namespace SM_TEST
|
||||||
|
|
||||||
MainFramebuffer = CreateWindowFramebuffer(16, PixelInformation.RGBA_HDR);
|
MainFramebuffer = CreateWindowFramebuffer(16, PixelInformation.RGBA_HDR);
|
||||||
|
|
||||||
_postBuffer = CreateWindowFramebuffer(0, depth: false);
|
_postBuffer = CreateWindowFramebuffer(0, PixelInformation.RGBA_HDR, depth: false);
|
||||||
Framebuffers.Add(_postBuffer);
|
Framebuffers.Add(_postBuffer);
|
||||||
_bloom = new BloomEffect(_postBuffer, hdr: true, .5f)
|
_bloom = new BloomEffect(_postBuffer, hdr: true, .5f)
|
||||||
{
|
{
|
||||||
Threshold = .5f
|
Threshold = .8f,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace SM_TEST
|
||||||
_bloom.Draw(context);
|
_bloom.Draw(context);
|
||||||
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||||
|
|
||||||
PostProcessUtility.FinalizeHDR(_postBuffer["color"], 1);
|
PostProcessUtility.FinalizeHDR(_postBuffer["color"], .5f);
|
||||||
|
|
||||||
context.Scene.DrawDebug(context);
|
context.Scene.DrawDebug(context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue