Better motionblur shader

  • NoMansReshade
  • Topic Author
More
7 years 4 months ago - 7 years 4 months ago #1 by NoMansReshade Better motionblur shader was created by NoMansReshade
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: 7 years 4 months ago by NoMansReshade.

Please Log in or Create an account to join the conversation.

  • Insomnia
More
7 years 4 months ago #2 by Insomnia Replied by Insomnia on topic Better motionblur shader
I agree with you. What I want is a depth dependant motion blur shader that either blurs pixels close to camera, or vice versa.

Please Log in or Create an account to join the conversation.

  • GP-Unity
More
7 years 4 months ago #3 by GP-Unity Replied by GP-Unity on topic Better motionblur shader
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.

Please Log in or Create an account to join the conversation.

  • Insomnia
More
7 years 4 months ago #4 by Insomnia Replied by Insomnia on topic Better motionblur shader
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.

Please Log in or Create an account to join the conversation.

  • crosire
More
7 years 4 months ago - 7 years 4 months ago #5 by crosire Replied by crosire on topic Better motionblur shader

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.
Last edit: 7 years 4 months ago by crosire.
The following user(s) said Thank You: GP-Unity

Please Log in or Create an account to join the conversation.

  • GP-Unity
More
7 years 4 months ago #6 by GP-Unity Replied by GP-Unity on topic Better motionblur shader
Oh right apologies for lack of knowledge and thanks for clearing that up.

Please Log in or Create an account to join the conversation.

  • Ederer
More
7 years 4 months ago - 7 years 4 months ago #7 by Ederer Replied by Ederer on topic Better motionblur shader
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: 7 years 4 months ago by Ederer.
The following user(s) said Thank You: Insomnia

Please Log in or Create an account to join the conversation.

  • Insomnia
More
7 years 4 months ago #8 by Insomnia Replied by Insomnia on topic Better motionblur shader
That looks amazing for being a post effect!!

Please Log in or Create an account to join the conversation.

  • GP-Unity
More
7 years 4 months ago - 7 years 4 months ago #9 by GP-Unity Replied by GP-Unity on topic Better motionblur shader
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: 7 years 4 months ago by GP-Unity.

Please Log in or Create an account to join the conversation.

  • Elimina
More
7 years 3 months ago #10 by Elimina Replied by Elimina on topic Better motionblur shader
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.

Please Log in or Create an account to join the conversation.

  • NoMansReshade
  • Topic Author
More
7 years 3 months ago - 7 years 3 months ago #11 by NoMansReshade Replied by NoMansReshade on topic Better motionblur shader

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: 7 years 3 months ago by NoMansReshade.

Please Log in or Create an account to join the conversation.

  • Elimina
More
7 years 2 months ago #12 by Elimina Replied by Elimina on topic Better motionblur shader

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.

Please Log in or Create an account to join the conversation.

  • Insomnia
More
7 years 2 months ago #13 by Insomnia Replied by Insomnia on topic Better motionblur shader

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.

Please Log in or Create an account to join the conversation.

  • NoMansReshade
  • Topic Author
More
7 years 2 months ago - 7 years 2 months ago #14 by NoMansReshade Replied by NoMansReshade on topic Better motionblur shader

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: 7 years 2 months ago by NoMansReshade.

Please Log in or Create an account to join the conversation.

  • magicart87
More
7 years 2 months ago #15 by magicart87 Replied by magicart87 on topic Better motionblur shader
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.

Please Log in or Create an account to join the conversation.

  • luluco250
More
7 years 1 month ago - 7 years 1 month ago #16 by luluco250 Replied by luluco250 on topic Better motionblur shader
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";>;
Last edit: 7 years 1 month ago by luluco250.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.