xxxxxxxxxx
42
precision mediump float;
// R = Energy
// G = Nutrition
// B = Moisture
// A = NA
varying vec2 pos;
uniform sampler2D soil_state;
uniform sampler2D filter_background;
uniform vec2 filter_res;
// uniform float sunlight;
float sunlight = 0.5;
vec3 absorption = vec3(0.2, 0.1, 0.1);
void main() {
vec4 col = texture2D(filter_background, pos);
vec4 avg = vec4(0.);
// Check neighbours
for(float i = -1.; i <= 1.; i ++) {
for(float j = -1.; j <= 1.; j ++) {
vec2 nPos = pos + (vec2(i, j)/filter_res);
vec4 nCol = texture2D(filter_background, nPos);
avg += nCol;
}
}
avg /= 9.;
col = avg * evaporation;
gl_FragColor = vec4(col.rgb, 1.);
}