Mindustry/core/assets/shaders/slag.frag

36 lines
911 B
GLSL
Raw Normal View History

2019-11-11 02:05:29 +07:00
#ifdef GL_ES
precision highp float;
precision mediump int;
#endif
2020-04-10 07:50:11 +07:00
//shades of slag
#define S2 vec3(100.0, 93.0, 49.0) / 100.0
#define S1 vec3(100.0, 60.0, 25.0) / 100.0
2020-04-10 08:03:16 +07:00
#define NSCALE 280.0 / 2.0
2019-11-11 02:05:29 +07:00
uniform sampler2D u_texture;
2020-04-10 07:50:11 +07:00
uniform sampler2D u_noise;
2019-11-11 02:05:29 +07:00
2020-04-10 07:50:11 +07:00
uniform vec2 u_campos;
uniform vec2 u_resolution;
uniform float u_time;
2019-11-11 02:05:29 +07:00
varying vec4 v_color;
varying vec2 v_texCoord;
void main(){
2020-04-10 07:50:11 +07:00
vec2 c = v_texCoord.xy;
vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y);
2019-11-11 02:05:29 +07:00
2020-04-10 07:50:11 +07:00
float btime = u_time / 4000.0;
float noise = (texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(btime * 1.1) * vec2(0.8, -1.0)).r) / 2.0;
vec3 color = texture2D(u_texture, c).rgb;
2019-11-11 02:05:29 +07:00
2020-04-10 07:50:11 +07:00
if(noise > 0.6){
color = S2;
}else if(noise > 0.54){
color = S1;
}
2019-11-11 02:05:29 +07:00
2020-04-10 07:50:11 +07:00
gl_FragColor = vec4(color.rgb, 1.0);
}