Page 1 of 1

GLSL Shader Help [Solved]

Posted: Thu Nov 14, 2013 4:13 am
by spynaz
I want to make a word's letters appear one by one. At first, I did it this way:

Code: Select all

local text = ""
local endText = "Hello, world!")
for i = 1, string.len(text) do
     text = string.sub(endText, 1, i)
end
And that works fine. But the problem is that it just doesn't look that smooth. So I came up with another idea which is using GLSL shaders to make it more smoother. And you can do that by making a pixel's alpha depending on how far along the x-axis it is from the starting point but I can't code in GLSL so can someone help me out?

Re: GLSL Shader Help

Posted: Thu Nov 14, 2013 6:17 am
by spynaz
Wait I actually did it myself! There is only one problem; it works fine with shapes, but when you apply it on the text it makes it really blurred. Does anyone know how to fix this? (See attached .love file, click "q" to activate shader when running)

Re: GLSL Shader Help

Posted: Thu Nov 14, 2013 8:15 pm
by mickeyjm
Err is it meant to do this:
ShaderText.png
ShaderText.png (2.43 KiB) Viewed 3262 times

Re: GLSL Shader Help

Posted: Thu Nov 14, 2013 8:24 pm
by spynaz
mickeyjm wrote:Err is it meant to do this:
The attachment ShaderText.png is no longer available
Yea that's exactly the problem I'm having. I need help with fixing that.

EDIT: Nvm, I FIXED IT MYSELF! :D I figured that when printing text on the screen, each pixel has a different alpha (as opposed to a shape where every pixel has the same alpha) so if each pixel's alpha turns out to be 255 at the end, the text just looks like a bunch of boxes. Know what I mean? So I just made it make sure that each pixel's alpha doesn't exceed it's max alpha. (See the attached fixed version)