PixelEffects, Y U NO WORK?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

PixelEffects, Y U NO WORK?

Post by Metalcookie »

So I've read the GLSL documentation, have read the readme on GLSL in Löve2D thousands of times and have searched everywhere on the forum and wiki..

All I'm trying to do is add some horizontal blur to the show. I've downloaded several .love files of examples of blur shaders, and looked a few simple examples up outside of Löve2D. Based on those examples, I made my own one ("my own one": 2% of it is my own work) and whatever I do, it won't work.

I have no problems at all running other people's .love files with shaders but whatever I make won't work ("won't work": Will compile without errors but there's no difference in the output with or without effects). I've included a .love file with purely the effect I'm trying to work with. (press space to apply the effect to the image)

Any ideas?

Info:
Löve2D version: 0.8.0 (10 dec)
OS: Win7 64-bit
Graphics card: AMD Radeon HD 6850
Attachments
LOLSHADERS.love
(409.63 KiB) Downloaded 242 times
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: PixelEffects, Y U NO WORK?

Post by slime »

In glsl/pixeleffect syntax, all floating point numbers (numbers of the type 'number'/float) needs to have a decimal.

Code: Select all

number blurSize = 1/800;
needs to become

Code: Select all

number blurSize = 1.0/800.0;
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

Re: PixelEffects, Y U NO WORK?

Post by Metalcookie »

slime wrote:In glsl/pixeleffect syntax, all floating point numbers (numbers of the type 'number'/float) needs to have a decimal.

Code: Select all

number blurSize = 1/800;
needs to become

Code: Select all

number blurSize = 1.0/800.0;
It works! I guess I'm not used to such a massive lack of forgiveness.
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: PixelEffects, Y U NO WORK?

Post by slime »

Something that's really annoying is that nvidia cards have more relaxed GLSL rules than ATI cards, so if you have an nvidia card and you make a mistake like that you might not notice until it fails on someone else's computer.
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

Re: PixelEffects, Y U NO WORK?

Post by Metalcookie »

Then I'm glad I have an ATI card.. But how about those Intel cards?

Also, I just noticed that the picture I used must be very familiar to you..
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: PixelEffects, Y U NO WORK?

Post by slime »

Oh god... don't even get me started on intel cards. I recently tried a pretty simple equality test in a shader for something using my ATI card, and when I switched to my Intel card it returned true under the exact opposite circumstances that it was supposed to!
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

Re: PixelEffects, Y U NO WORK?

Post by Metalcookie »

I'm really gonna stop with PixelEffects after this because I keep bumping into problems where I don't know what's causing them..

So now I want to change the blur effect in such a way that I can set the amount of samples it takes. I tried this using a for-loop, but somehow it just won't work again.

What I'm trying to do is replacing this(which works):

Code: Select all

sum += Texel(tex, tc - vec2(4.0*blurSize, 0.0)) * 0.6;
sum += Texel(tex, tc - vec2(3.0*blurSize, 0.0)) * 0.7;
sum += Texel(tex, tc - vec2(2.0*blurSize, 0.0)) * 0.8;
sum += Texel(tex, tc - vec2(blurSize, 0.0)) * 0.9;
sum += Texel(tex, tc + vec2(blurSize, 0.0)) * 0.9;
sum += Texel(tex, tc + vec2(2.0*blurSize, 0.0)) * 0.8;
sum += Texel(tex, tc + vec2(3.0*blurSize, 0.0)) * 0.7;
sum += Texel(tex, tc + vec2(4.0*blurSize, 0.0)) * 0.6;
by this(which doesn't):

Code: Select all

for (number i = 1.0; i >= 4.0; i += 1.0){
	sum += Texel(tex, tc + vec2(i*blurSize, 0.0)) * (1.0-(i/10.0));
	sum += Texel(tex, tc - vec2(i*blurSize, 0.0)) * (1.0+(i/10.0));
}
Because with the latter, I can change the "4.0" in "i >= 4.0;" to the amount of samples I want to take.

But it fails to do anything useful with 'sum' other than to leave it alone..

In the .love file I attached, it applies the effect after pressing space. The blur on the x-axis uses the for-loop, while the blur on the y-axis doesn't.

EDIT: I might also add that I'm doing this effect on a white dot surrounded by emptiness, so the sum will never exceed 1.0 even though the weights are high.
Attachments
LOLSHADERS.love
(2.63 KiB) Downloaded 187 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: PixelEffects, Y U NO WORK?

Post by bartbes »

I'm pretty sure you want <=.
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

Re: PixelEffects, Y U NO WORK?

Post by Metalcookie »

bartbes wrote:I'm pretty sure you want <=.
I even know how I made that mistake..
It's because I tried two possible solutions to an earlier problem, which included changing it to '>='. But the other solution was the solution that solved it, and without realizing I left this 'solution' in. That's what I get for rushing this stuff, I guess.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests