Motion Blur effect

I have a question
I would like to add a sprite blur effect, when the object is moving. The higher the speed, the bigger the blur. Is it possible to achieve this programmatically ?

1 Like

Youd have to search and learn about render targets. Although im not the best person to give aid about, for i have tried in the past making something similar but didnt quite achieve it. But i think that for something like that there might be an already existing extension.

Hi @FredZX !

What you want to achieve is most probably a motion blur. I once adapted an implementation of motion blur from shadertoy (Shader - Shadertoy BETA) as a fragment program for a sprite to Defold:

You probably want it rather to be aplied to everything on your screen, so you might render your scene to a render target (a separate, internal buffer/texture) and then perform this motion blur as a postprocessing when drawing this render target to a quad (simplest plane, a geometry to which you assign a texture) and this quad will fill the screen. This is the most common post-processing pipeline in Defold, let us know if this is understandable to you or you need more explanations :wink:

You might get to know how to draw to an offset buffer / render target and to quad filling the screen after watchin my video:

or reading official Defold example:

After understading how to make post-processing with this technique - let us know how are you familiar with GLSL and if you can adapt the motion blur example to your needs :wink:

4 Likes

I’m not familiar with this technique, but I’m going to try it :wink:

1 Like

I will be experimenting with this, maybe I will come with some solution, but please don’t rely on me, it could be that I will get it done quickly or after ages, as I rarely have time for such experiments, sorry! :sweat_smile:

But if you will try and get stuck on anything, let us know and we will try to help :blush:

2 Likes