Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help getting this to work on 2019.4 #9

Open
PpHammer opened this issue Sep 25, 2020 · 7 comments
Open

Help getting this to work on 2019.4 #9

PpHammer opened this issue Sep 25, 2020 · 7 comments

Comments

@PpHammer
Copy link

Hi!

We are in need of proper motion blur of our new game. This looks great but we cannot seem to get it to work.
Not even after implementing some fixes as mentioned under the pull requests.

We're implementing it into a racing game. Motionblur is only working for the bottom right quarter of the screen.
When driving backwards it seems better.

Can the asset get a bit of TLC to get it to work under new(er) Unity versions.

I suspect that Unity's own implementation will take a some time :(

Cheers & thanks,
Pieter

@EsiNikko
Copy link

Hi.
I'm already using it in Unity 2019.4.x with no problem, but I had to apply some fixes that I suggested in the pull request. I even added the ability to filter motion-blurred objects with a LayerMask field. I will push this new feature in another branch someday soon.
by the way, if you tell the exact version of the Unity you trying to use, I'll give it a try and let you know if I had any solution.

@PpHammer
Copy link
Author

Hi EsiNikko!

Thanks for your reply! I am on 2019.4.2f1 and URP 7.4.3.

I can get it to work - more or less - as per your fixes but I am not getting proper results.
Weirdly enough when I drive backwards the effects seems to work ok - when racing forward I only have the effect in the bottom right.

The camera is following the car - it is not linked or anything - it is just following it in LateUpdate.
Don't know what to check yet atm... :(

PIeter

@PpHammer
Copy link
Author

I just can't get it to work in 2019.4.12.

I have implemented the changes as suggested by EsiNikko, but the best I can get is motionblur when moving backwards. Or motionblur on the right side of the screen - but smeared to the right.

It also 'ticks' as if one frame it is rendered the other frame it is not - my guess is that this is related to my camera being updated in fixedUpdate.

Long story short - this seems to be the best solution for object motion blur for urp at the moment - but it is a bit fiddly to get to work

@PpHammer
Copy link
Author

BlurLowerRight

This is the effect I currently have - this happens when the camera is moving forward.

Anyone?

@fleity
Copy link

fleity commented Feb 18, 2021

I have this setup using @EsiNikko branch and while it does work somewhat I can probably report the same issue as PpHammer. I spin an object in a circle and during 3/4 of the rotation the motion blur works but during one quarter the object is not blurred at all. It seems dependent on the view direction of the camera as it is always the same part of the rotation (lower right part of the circle, towards the camera).
Unity 2019.4.16f1 - URP 7.5.3

@ThomasChen1220
Copy link

I looked into the code and the reason why it's doing this is probably because the velocity texture is using RGBA32 when it should be using RGFloat.
image

To fix this, in MotionVectorRenderPass.cs after line 49, add :
cameraTextureDescriptor.colorFormat = RenderTextureFormat.RGFloat;

Also in MotionVector.shader, change line 20 to this:
TEXTURE2D_FLOAT(_MotionVectorTexture); SAMPLER(sampler_MotionVectorTexture);

@fleity
Copy link

fleity commented Aug 13, 2021

Over on EsiNikko's and my fork we fixed that texture format issue and a bunch of smaller other issues as well. Additionally to the RGFloat format (which isn't supported on many mobiles devices I've heard, probably the reason it was a more regular one) you have to change the shader to (un-)pack it correctly and when clearing the texture clear it with 0.5 instead of zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants