Better bloom

This commit is contained in:
Anuken 2022-04-26 00:19:14 -04:00
parent aab6c3a9df
commit f6e0c0ce11
4 changed files with 8 additions and 34 deletions

View File

@ -6,8 +6,10 @@ uniform lowp float OriginalIntensity;
varying vec2 v_texCoords;
void main(){
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
original = original * (vec4(1.0) - vec4(bloom.rgb, 0.0));
gl_FragColor = original + bloom;
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
original = original * (vec4(1.0) - bloom);
vec4 combined = original + bloom;
float mx = min(max(combined.r,max(combined.g,combined.b)), 1.0);
gl_FragColor = vec4(combined.rgb/mx,mx);
}

View File

@ -15,32 +15,4 @@ void main(){
+ center * texture2D(u_texture, v_texCoords2)
+ close * texture2D(u_texture, v_texCoords3)
+ far * texture2D(u_texture, v_texCoords4);
//TODO this is broken (too bright)
/*
vec4
v1 = texture2D(u_texture, v_texCoords0),
v2 = texture2D(u_texture, v_texCoords1),
v3 = texture2D(u_texture, v_texCoords2),
v4 = texture2D(u_texture, v_texCoords3),
v5 = texture2D(u_texture, v_texCoords4);
float
a1 = v1.a * far,
a2 = v2.a * close,
a3 = v3.a * center,
a4 = v4.a * close,
a5 = v5.a * far;
gl_FragColor = vec4(
//RGB values are weighed by their alpha values and their base weight (less alpha -> less contribution)
(v1.rgb * a1 + v2.rgb * a2 + v3.rgb * a3 + v4.rgb * a4 + v5.rgb * a5) /
//RGB must then be weighed by the sum of all alpha processed. don't allow divide by zero
max(a1 + a2 + a3 + a4 + a5, 0.0001),
//alpha is just the weighed sum
a1 + a2 + a3 + a4 + a5);*/
}

View File

@ -3382,7 +3382,7 @@ public class UnitTypes{
colors = new Color[]{Color.valueOf("bf92f9").a(0.4f), Color.valueOf("bf92f9"), Color.white};
//TODO merge
chargeEffect = new MultiEffect(Fx.lancerLaserCharge, Fx.lancerLaserChargeBegin);
width = 20f;
width = 4f;
largeHit = false;
buildingDamageMultiplier = 0.25f;

View File

@ -36,6 +36,7 @@ public class Door extends Wall{
config(Boolean.class, (DoorBuild base, Boolean open) -> {
doorSound.at(base);
base.effect();
for(DoorBuild entity : base.chained){
//skip doors with things in them
@ -45,7 +46,6 @@ public class Door extends Wall{
entity.open = open;
pathfinder.updateTile(entity.tile());
entity.effect();
}
});
}