Page 1 of 1

Scent System

Posted: Mon Feb 21, 2022 8:43 pm
by Taviszorn
Hello!

I want to implement a scent-like system in my program. It would work in a way, that if there is color on the canvas, then it would spread to the pixels nearby (kinda like a blur) and disappear over time. I imagine it would look like the colors diffuse, which is what I want.
Do I need some sort of shader to do this? If so, how? I don't really understand how they work, so any help would be really appreciated!

Thank You in advance!

Re: Scent System

Posted: Tue Feb 22, 2022 8:02 am
by darkfrei

Re: Scent System

Posted: Tue Feb 22, 2022 8:10 am
by veethree
The way I see it you have 2 options. You can use a shader, check out this blog post for a basic primer on how they work. Or you could use a cellular automaton.

If your game is grid based in some way a cellular automaton might be the better option, otherwise shaders.

This kind of shader could make use of convolution matrices, check out this video for a primer

Re: Scent System

Posted: Sat Feb 26, 2022 7:52 pm
by knorke
Another way could be to use a particle system. Particles that slowly drift away and fade out.
Löve's particle system: https://love2d.org/wiki/ParticleSystem