Page 1 of 1

intensity of printing

Posted: Mon Dec 31, 2018 12:57 pm
by randy0428
While experimenting I accidently printed two nearly identical strings ("test1" and "test2") in the same location. When I corrected this, it seemed as though the text of the two separate strings was not as intense/bright as when they overlapped. So I did a test. I printed the "test1" string 4 times at the same location and the "test2" sting just once below it. The string that is printed 4 times at the same location is clearly more intense/brighter.

Is there a way to get this brighter effect without printing multiple times?

Re: intensity of printing

Posted: Mon Dec 31, 2018 6:08 pm
by pgimeno
With a shader, you can modulate the alpha. The effect shouldn't be very different.

Code: Select all

local shader = love.graphics.newShader[[
extern number gamma;
vec4 effect(vec4 colour, Image texture, vec2 texpos, vec2 scrpos)
{
    return colour * vec4(Texel(texture, texpos).rgb, pow(Texel(texture, texpos).a, gamma));
}
]]

function love.draw(txt)
  shader:send('gamma', 0.35)
  love.graphics.setShader(shader)
  love.graphics.print("test1")
  love.graphics.setShader()
  love.graphics.print("test2", 0, 40)
end
You could also use a different font, e.g. one with boldface, or create a bitmap font.

Re: intensity of printing

Posted: Tue Jan 01, 2019 6:44 pm
by randy0428
Thanks pgimento.
Your reply is a bit over my head at my current level of knowledge of löve. At this time this is not a terribly important thing for me. Perhaps sometime in the future I'll revisit this topic and learn about shaders.

Re: intensity of printing

Posted: Thu Jan 03, 2019 3:54 am
by NobodysSon
I'm curious as why the line with multiple reprintings is more intense. Are multiple alpha levels being combined or what?

Re: intensity of printing

Posted: Thu Jan 03, 2019 4:44 am
by zorg
NobodysSon wrote:
Thu Jan 03, 2019 3:54 am
I'm curious as why the line with multiple reprintings is more intense. Are multiple alpha levels being combined or what?
That's exactly what's happening.