Code: Select all
local default = [[
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords) {
vec4 tc = Texel(texture, texture_coords);
number shift = 0.1f;
vec4 r = Texel(texture, vec2(tc.x + shift, tc.y - shift));
vec4 g = Texel(texture, vec2(tc.x, tc.y + shift));
vec4 b = Texel(texture, vec2(tc.x - shift, tc.y - shift));
number a = r.a*g.a*b.a / 3.0f;
return vec4(r.r, g.g, b.b, a);
}
]]
function love.load()
shader = love.graphics.newShader(default)
end
function love.draw()
love.graphics.setShader(shader)
love.graphics.printf("TestingTestingTestingTestingTesting", 100,100,500,'left')
love.graphics.rectangle('fill', 400,400, 50,50)
love.graphics.setShader()
end
***Edit: I just fixed it somewhat. Futher problem is that the square isn't splitting as it should. Also the text are just in boxes.
Code: Select all
local default = [[
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords) {
vec2 tc = texture_coords;
vec2 scale = vec2(1.0/800.0, 1.0/600.0);
number shift = 5.0;
vec4 r = Texel(texture, vec2(tc.x + shift * scale.x, tc.y - shift * scale.y));
vec4 g = Texel(texture, vec2(tc.x, tc.y + shift*scale.y));
vec4 b = Texel(texture, vec2(tc.x - shift*scale.x, tc.y - shift*scale.y));
//number a = r.a*g.a*b.a / 3.0;
return vec4(r.r, g.g, b.b, 1.0);
}
]]
function love.load()
shader = love.graphics.newShader(default)
end
function love.draw()
love.graphics.setShader(shader)
love.graphics.printf("TestingTestingTestingTestingTesting", 100,100,500,'left')
love.graphics.rectangle('fill', 400,400, 50,50)
love.graphics.setShader()
end
***Edit: Just fixed the text not appearing, I just averaged the alpha of the sampled r/g/b from around the current pixel. It does look somewhat nice, probably should just set it to the highest alpha out of the alpha returns. I also haven't fixed the box though. Maybe I need to put it into a canvas?
Code: Select all
local default = [[
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords) {
vec2 tc = texture_coords;
vec2 scale = vec2(1.0/800.0, 1.0/600.0);
number shift = 2.0;
vec4 r = Texel(texture, vec2(tc.x + shift * scale.x, tc.y - shift * scale.y));
vec4 g = Texel(texture, vec2(tc.x, tc.y + shift*scale.y));
vec4 b = Texel(texture, vec2(tc.x - shift*scale.x, tc.y - shift*scale.y));
number a = r.a+g.a+b.a / 3.0;
return vec4(r.r, g.g, b.b, a);
}
]]
function love.load()
shader = love.graphics.newShader(default)
end
function love.draw()
love.graphics.setShader(shader)
love.graphics.printf("TestingTestingTestingTestingTesting", 100,100,500,'left')
love.graphics.rectangle('fill', 400,400, 50,50)
love.graphics.setShader()
end