mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-03 04:44:24 +07:00
Better bloom
This commit is contained in:
parent
aab6c3a9df
commit
f6e0c0ce11
@ -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);
|
||||
}
|
||||
|
@ -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);*/
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user