intensity of printing

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

intensity of printing

Post by randy0428 » Mon Dec 31, 2018 12:57 pm

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?
Attachments
intensity.png
intensity.png (5.87 KiB) Viewed 694 times

User avatar
pgimeno
Party member
Posts: 1557
Joined: Sun Oct 18, 2015 2:58 pm

Re: intensity of printing

Post by pgimeno » Mon Dec 31, 2018 6:08 pm

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.

randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

Re: intensity of printing

Post by randy0428 » Tue Jan 01, 2019 6:44 pm

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.

User avatar
NobodysSon
Prole
Posts: 28
Joined: Tue Oct 30, 2012 10:37 pm

Re: intensity of printing

Post by NobodysSon » 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?

User avatar
zorg
Party member
Posts: 2554
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: intensity of printing

Post by zorg » Thu Jan 03, 2019 4:44 am

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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Post Reply

Who is online

Users browsing this forum: No registered users and 187 guests