Welcome, Guest.
Username: Password: Remember me

TOPIC: Better motionblur shader

Better motionblur shader 1 year 5 months ago #1

From what I understand, reshade only has access to the current frame and the previous frame (correct me if I'm wrong). That being said, is it possible to make decent looking motionblur like the one seen in unreal engine 4? I'm no professional shader coder, but I can see that "traditional" motionblur methods use either motion vectors, or multiple frames (5 frames back or more etc.). The shader included with reshade 3.0 works as intended, however the resulting image ends up making me look drunk.

Drunk Example

Motionblur Example

Sorry for the poor examples, but hopefully you get what I am trying to say! This happens because of either the lack of resources reshade has access to, or because of the shader implementation. Any info is greatly appreciated!
Last Edit: 1 year 5 months ago by NoMansReshade.
The administrator has disabled public write access.

Better motionblur shader 1 year 5 months ago #2

I agree with you. What I want is a depth dependant motion blur shader that either blurs pixels close to camera, or vice versa.
The administrator has disabled public write access.

Better motionblur shader 1 year 5 months ago #3

Many of us would like to see a great motion blur shader. Reshade however, doesn't have access to the previous frame(s). It's the same reason temporal anti-aliasing can't be implemented. Remember, Reshade in its current state can only work with the current frame, which means it doesn't know where to apply blur.
The administrator has disabled public write access.

Better motionblur shader 1 year 5 months ago #4

But since ReShade has access to depth buffers shouldn't it be possible to use the depth buffer to apply motion blur close to camera like in UE4?
Screen based depth dependant motion blur, so to say. Not object based.
The administrator has disabled public write access.

Better motionblur shader 1 year 5 months ago #5

GP-Unity wrote:
Many of us would like to see a great motion blur shader. Reshade however, doesn't have access to the previous frame(s). It's the same reason temporal anti-aliasing can't be implemented. Remember, Reshade in its current state can only work with the current frame, which means it doesn't know where to apply blur.
That's not true. It's possible to get access to previous frames. The current "Motion Blur" shaders does exactly that, or else it wouldn't work at all. But that is not what you need for true motion blur. True motion blur only applies to objects that actually move and does not apply to objects that are static. This information is not available. Some games store it in some form of a velocity buffer and therefore can do proper motion blur. But as said, ReShade does not have access to that data.
Cheers, crosire =)
Last Edit: 1 year 5 months ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: GP-Unity

Better motionblur shader 1 year 5 months ago #6

Oh right apologies for lack of knowledge and thanks for clearing that up.
The administrator has disabled public write access.

Better motionblur shader 1 year 5 months ago #7

It's possible to generate a motion vector / velocity buffer by tracking the motion of the rgb pixels (between the current and the previous frame).

Compositing software like Nuke or AfterEffects can do that with any video or image sequence.

Here is an example on youtube of how the (commercial) After Effects plugin "ReelSmart Motion Blur" looks on recorded game footage:
(go to 1min20s)


It's not as accurate as using the velocity buffer the game engine would provide, e.g. there will probably be some artifacts, but it's usually quite convincing.

This is just a 2d post effect, there is no need to access the objects or cameras 3d-position.
So i guess in theory it would be possible to write such a shader for reshade, not sure about the fps hit though.... ;-)

I'm not a coder, but maybe this helps:
opencv-python-tutroals.readthedocs.io/en...py_lucas_kanade.html
Last Edit: 1 year 5 months ago by Ederer.
The administrator has disabled public write access.
The following user(s) said Thank You: Insomnia

Better motionblur shader 1 year 5 months ago #8

That looks amazing for being a post effect!!
The administrator has disabled public write access.

Better motionblur shader 1 year 5 months ago #9

Familiar with this effect (after effects' rsmb) and it is why i thought Reshade only read the current frame. Good to know this is possible. If we can implement this (unfortunately demanding) effect, even games without depth buffer access can receive a good motion blur implementation.
Last Edit: 1 year 5 months ago by GP-Unity.
The administrator has disabled public write access.

Better motionblur shader 1 year 4 months ago #10

One thing you guys aren't thinking about: RSMB is a post processing effect that is way too demanding to be used on any game, no matter how powerful your PC is. Using this effect already takes lot longer to render 60 frames than seeing 60 fps in a game, so I wouldn't imagine the in-game effect to be pleasant to use.
The administrator has disabled public write access.

Better motionblur shader 1 year 4 months ago #11

Elimina wrote:
One thing you guys aren't thinking about: RSMB is a post processing effect that is way too demanding to be used on any game, no matter how powerful your PC is. Using this effect already takes lot longer to render 60 frames than seeing 60 fps in a game, so I wouldn't imagine the in-game effect to be pleasant to use.

But surely we could at least get a better motion blur than the "Drunk" frame blending shader we have now, right? Like the one seen in this example?
Last Edit: 1 year 4 months ago by NoMansReshade.
The administrator has disabled public write access.
The following user(s) said Thank You: Ruking

Better motionblur shader 1 year 3 months ago #12

NoMansReshade wrote:

But surely we could at least get a better motion blur than the "Drunk" frame blending shader we have now, right? Like the one seen in this example?

Anything is better than the one we have currently :P I'm not certain on this, but I think that this code uses the object's velocity/speed & distance to determine the amount of motion blur that is applied, which if I remember correctly, ReShade's depth buffer provides distance calculations but is unable to detect velocity.

There is one method that Ganossa was working on that could fix half of the problem, but recognizing an objects velocity is usually handled through methods that ReShade cannot access. I do know that Ganossa was working on a motion blur based in mouse movements (to simulate camera rotation), but I don't know what happened to that project.
The administrator has disabled public write access.

Better motionblur shader 1 year 3 months ago #13

Elimina wrote:
NoMansReshade wrote:

But surely we could at least get a better motion blur than the "Drunk" frame blending shader we have now, right? Like the one seen in this example?

Anything is better than the one we have currently :P I'm not certain on this, but I think that this code uses the object's velocity/speed & distance to determine the amount of motion blur that is applied, which if I remember correctly, ReShade's depth buffer provides distance calculations but is unable to detect velocity.

There is one method that Ganossa was working on that could fix half of the problem, but recognizing an objects velocity is usually handled through methods that ReShade cannot access. I do know that Ganossa was working on a motion blur based in mouse movements (to simulate camera rotation), but I don't know what happened to that project.

Depth based motion blur is what I would like. :) Blur close to camera and not the whole screen like it is today.
The administrator has disabled public write access.

Better motionblur shader 1 year 3 months ago #14

Elimina wrote:
NoMansReshade wrote:

But surely we could at least get a better motion blur than the "Drunk" frame blending shader we have now, right? Like the one seen in this example?

Anything is better than the one we have currently :P I'm not certain on this, but I think that this code uses the object's velocity/speed & distance to determine the amount of motion blur that is applied, which if I remember correctly, ReShade's depth buffer provides distance calculations but is unable to detect velocity.

There is one method that Ganossa was working on that could fix half of the problem, but recognizing an objects velocity is usually handled through methods that ReShade cannot access. I do know that Ganossa was working on a motion blur based in mouse movements (to simulate camera rotation), but I don't know what happened to that project.

Couldn't you just capture the depth buffer from the current frame, store it until the next frame is done and then use that to determine velocity (which would add delay but who cares) ??

EDIT:
Because my understanding is that the current motion blur shader captures the current frame and stores it, then uses that to determine velocity; blurring the entire screen as a whole (effectively creating the "drunk" effect we see now.)
Last Edit: 1 year 3 months ago by NoMansReshade.
The administrator has disabled public write access.

Better motionblur shader 1 year 3 months ago #15

What about adding a mask overlay that would make blur more extreme at the ends and less extreme in the center. Sorta like tunnel vision.
The administrator has disabled public write access.

Better motionblur shader 1 year 2 months ago #16

Something that I had experimented with before, and worked for the most part, was using the mouse velocity as the camera velocity. You won't get per-object motion blur, but at least something similar.

You need two separate 1x1 RG32F (32-bit float2) textures, one fire saving the velocity and one for saving the last mouse position (from the last frame), you then get the speed using:
vel = (last - curr) * sensitivity;
'sensitivity' being an uniform.

The problem with this is that motion blur stops working when the mouse hits the screen edges, the velocity is simply calculated to 0 if the cursor doesn't actually move.

My suggestion would be to add a new uniform to ReShade that gets the input directly from the mouse driver, not from Windows, so we could save a true mouse velocity uniform (and not even have to deal with it inside the shader itself).

Another thing you could improve upon is using some sort of distortion on the edges of the screen blur to simulate that spherical-looking motion blur you seen in games like Crysis.

Oh and you can get the mouse position with:
float2 f2Mouse <source="mousepoint";>;
Likes to reinvent the wheel.

My shaders repository: www.github.com/luluco250/FXShaders
Last Edit: 1 year 2 months ago by luluco250.
The administrator has disabled public write access.