Search Unity

Postprocessing Stack : how to remove motion blur from my gun?

Discussion in 'Image Effects' started by CGDever, Jan 6, 2021.

  1. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    156
    Hi here!

    Thanks @PhobicGunner for the amazing article (https://forum.unity.com/threads/first-person-rendering-in-unity-5-writeup.401513/)!

    I was trying (unsuccessfully) to use these two threads:
    a) https://forum.unity.com/threads/first-person-rendering-in-unity-5-writeup.401513/
    b) https://forum.unity.com/threads/first-person-rendering.483361/

    I wasn't able to work out how to draw guns (a cube in my test project) on top of everything whilst supporting Post Processing (MotionBlur effect).
    From beginning...

    0) Unity 2020.1.17f1, camera mode is "deferred"

    1) I created a custom "UnityShaderUtilities.cginc" file with custom UnityObjectToClipPos. I put it into Unity's CGIncludes. This part went according to your instructions :)

    2) I overwrote "Internal-MotionVectors.shader" (and attached it to the project in the Project Settings -> Graphics -> Motion Vectors).

    3) In my custom depth-hack shader ("GGG.shader") I added "#pragma multi_compile __ FIRST_PERSON".

    4) In the script I'm enabling the keyword and passing matrices into the shader as global variables (as you showed).

    As a result, something doesn't work. It's not clear what doesn't work, but the symptoms are:
    - the cube (my gun) is drawn on top of everything (in the wrong way, it seems inside out? ok, at least somehow it's on top...)
    - the cube is too blurry (this one I wasn't able to fix for a week)


    Here is the link to my test project: https://yadi.sk/d/afmVkvfTvblCFA

    Guys, could somebody explain what's wrong??? How to render the cube on top of everything without motion blur???