Page 1 of 1

Question about coloring images

Posted: Thu Sep 27, 2012 2:35 pm
by mode7
Hey everybody,

I have a question about coloring my drawings:
Im trying to add a fog effect to my 3d camera. As the distance gets bigger, the fog color is supposed to gradually turn completely opaque. I tried using love.graphics.setColor but it is only possible to 'tint' the drawable in the color. Set the color mode to 'combine' gives better results but still does not solve my problem.
Basically what i want is something like a color overlay with variable opacity that only covers the drawable.

So my question: Is there a) a way to achieve this in love or b) is there a libray/module which does that or c) any idea how to achieve this?

I really hope you can help me

Re: Question about coloring images

Posted: Thu Sep 27, 2012 2:51 pm
by kikito
Have you tried drawing rectangles of varying opacity on top of the images? With love.graphics.rectangle and love.graphics.setColor, I mean.

Re: Question about coloring images

Posted: Thu Sep 27, 2012 2:56 pm
by mode7
Already did that.The problem is that you need quite a few rectangles to get a smooth fog effect. This will result in a massive slowdown and I cant see the background anymore.

Re: Question about coloring images

Posted: Thu Sep 27, 2012 6:45 pm
by Ref
mode7 wrote:Hey everybody,

I have a question about coloring my drawings:
Im trying to add a fog effect to my 3d camera. As the distance gets bigger, the fog color is supposed to gradually turn completely opaque. I tried using love.graphics.setColor but it is only possible to 'tint' the drawable in the color. Set the color mode to 'combine' gives better results but still does not solve my problem.
Basically what i want is something like a color overlay with variable opacity that only covers the drawable.

So my question: Is there a) a way to achieve this in love or b) is there a libray/module which does that or c) any idea how to achieve this?

I really hope you can help me
setPixelEffect

Re: Question about coloring images

Posted: Thu Sep 27, 2012 8:19 pm
by mode7
Thanks for the detailed answer ;)
You're right shaders are the way to go here. Unfortunately I don't know anything about GL or GLSL. I would be totally thankful for everything that puts me in the right direction.