Enabling Motion Vectors for VAT

Hi!

We started to work with Vertex Animation Texture recently and we used as reference keijiro sample: GitHub - keijiro/HdrpVatExample: VAT (Vertex Animation Texture) with Unity Shader Graph and Visual Effect Graph

Unity 2019.4.3f1 and HDRP 7.4.1

I am trying to enable Motion Vectors for vertex animation created in shader graph and I found two steps that actually do something.

  1. Enable Motion Vector For Vertex Animation
  2. Enable Precomputed Velocity
    6140649--670122--upload_2020-7-28_11-12-1.png

In results I see some motion blur but it is working incorrectly. Everything becomes blurred. I understand that i do not need precomputed velocity because this option will work only with Alembic files but if I enable only Motion Vector for Vertex Animation it do not reacts with Motion Blur at all.

Enable precomputed and MV for VA
6140649--670125--upload_2020-7-28_11-17-39.png

Disable one of the parameters or both
6140649--670128--upload_2020-7-28_11-18-0.png

1 Like

I see kinda the same problem here and there is hacky and tricky way to make it work with custom pass api. I hope we will have better way someday.

i haven’t tried this. but from what i remember looking into the motion vector code:
if motion vector are enabled the shader will call your vertex animation function twice. 1. using the current time, 2. using the previous time (both coming from the engine) in order to calculate the diff or motion.
looking into the vat code it uses an input called “currentFrame” to get the right pixel to sample from. So in order to make this work you will have to find way to map previous time to previous fame.
unfortunately you can’t do this within shader graph but have to edit the generated hlsl file.