SFML community forums
Help => Graphics => Topic started by: Nafffen on May 14, 2023, 04:11:54 pm
-
Hello,
What is the best and efficient way to apply gaussian blur without shaders ? (because I want to play on android later)
Is drawing on RenderTexture and CPU compute blur the best way ? It seems too expensive to me
Thank you
-
Depends a bit what you want to use it for. Maybe you don't need proper (gaussian) blur, but can live with something much simpler that has a similar effect?
-
Yes gaussian blur is the kind of result I would like, box blur could give also good result
Sorry to re-open the topic on the handle of shader with android, but can I wait for it or I really need to find another slotution with that ?
-
I guess drawing the same thing multiple times at slight offsets with a lower opacity (or darker with addition) wouldn't suffice? Seems a bit of an intensive way to do it :(
Another option, however, is to draw a lower resolution version scaled up (and smoothed).
You could use either a lower resolution texture or draw the full resolution texture scaled down on a render texture and then draw that scaled back up.
Of course, remember to turn on texture smoothing.
EDIT:
Here's an example of a test I just made for you :) :
(https://i.imgur.com/JTNYUKa.png)
Here, the right-side sprite is drawn to a render texture at an 1/8th of its size and then scaled back up with texture smoothing and drawn to the left-side.
-
Oh yes I didn't think about that !
Thank you for the little example I am going to try this :D
-
Hope it goes well for you!
Remember it's really just pixelation with smoothing so it's quite boxy but it is blurry, I guess ;D