light_world.lua/lib/shaders/postshaders/monochrome.lua

16 lines
525 B
Lua
Raw Normal View History

2016-04-30 13:37:28 +00:00
return [[//
2014-03-28 02:32:32 +00:00
extern float time = 0.0;
2014-04-08 17:45:21 +00:00
extern vec3 tint = vec3(1.0, 1.0, 1.0);
extern float fudge = 0.1;
2014-03-28 02:32:32 +00:00
float rand(vec2 position, float seed) {
2016-04-30 13:37:28 +00:00
return fract(sin(dot(position.xy,vec2(12.9898, 78.233))) * seed);
2014-03-28 02:32:32 +00:00
}
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords){
vec4 pixel = Texel(texture, texture_coords);
2014-04-08 17:45:21 +00:00
float intensity = (pixel.r + pixel.g + pixel.b) / 3.0 + (rand(texture_coords, time) - 0.5) * fudge;
return vec4(intensity * tint.r, intensity * tint.g, intensity * tint.b, 1.0);
2016-04-30 13:37:28 +00:00
}
]]