Better bloom
This commit is contained in:
@@ -6,8 +6,10 @@ uniform lowp float OriginalIntensity;
|
|||||||
varying vec2 v_texCoords;
|
varying vec2 v_texCoords;
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
|
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
|
||||||
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
|
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
|
||||||
original = original * (vec4(1.0) - vec4(bloom.rgb, 0.0));
|
original = original * (vec4(1.0) - bloom);
|
||||||
gl_FragColor = original + 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,32 +15,4 @@ void main(){
|
|||||||
+ center * texture2D(u_texture, v_texCoords2)
|
+ center * texture2D(u_texture, v_texCoords2)
|
||||||
+ close * texture2D(u_texture, v_texCoords3)
|
+ close * texture2D(u_texture, v_texCoords3)
|
||||||
+ far * texture2D(u_texture, v_texCoords4);
|
+ 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);*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3382,7 +3382,7 @@ public class UnitTypes{
|
|||||||
colors = new Color[]{Color.valueOf("bf92f9").a(0.4f), Color.valueOf("bf92f9"), Color.white};
|
colors = new Color[]{Color.valueOf("bf92f9").a(0.4f), Color.valueOf("bf92f9"), Color.white};
|
||||||
//TODO merge
|
//TODO merge
|
||||||
chargeEffect = new MultiEffect(Fx.lancerLaserCharge, Fx.lancerLaserChargeBegin);
|
chargeEffect = new MultiEffect(Fx.lancerLaserCharge, Fx.lancerLaserChargeBegin);
|
||||||
width = 20f;
|
width = 4f;
|
||||||
largeHit = false;
|
largeHit = false;
|
||||||
|
|
||||||
buildingDamageMultiplier = 0.25f;
|
buildingDamageMultiplier = 0.25f;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class Door extends Wall{
|
|||||||
|
|
||||||
config(Boolean.class, (DoorBuild base, Boolean open) -> {
|
config(Boolean.class, (DoorBuild base, Boolean open) -> {
|
||||||
doorSound.at(base);
|
doorSound.at(base);
|
||||||
|
base.effect();
|
||||||
|
|
||||||
for(DoorBuild entity : base.chained){
|
for(DoorBuild entity : base.chained){
|
||||||
//skip doors with things in them
|
//skip doors with things in them
|
||||||
@@ -45,7 +46,6 @@ public class Door extends Wall{
|
|||||||
|
|
||||||
entity.open = open;
|
entity.open = open;
|
||||||
pathfinder.updateTile(entity.tile());
|
pathfinder.updateTile(entity.tile());
|
||||||
entity.effect();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user