I’m trying to understand motion vectors so I can make them work for my custom skinned mesh renderer. I read somewhere that all you need to do is supply the previous frame’s mesh data inside TEXCOORD4. Seems simple enough.
Currently, I’m rendering using Graphics.DrawMesh(). There doesn’t seem to be any way to indicate that you want to use motion vectors with DrawMesh(), but I suppose you could always fall back on using a MeshRenderer instead. However, I can’t even seem to get them to work on a regular MeshRenderer, like a cube created inside the Unity interface.
I have this very simple testing scene:
The character is standard skinned mesh, the cube is MeshRenderer.
In the frame debugger, only the character will be rendered into the motion vectors buffer. This happens regardless if the character moves or not. However, the cube moving has no effect on whether or not it is included in this pass.
The cube has motion vectors enabled, and yet nothing:
What exactly am I doing wrong here? Why isn’t the cube included?
And is there a way to get motion vectors working with Graphics.DrawMesh()?
edit:
The cube won’t be included in motion buffers regardless of what shader is used. I can use HDRP/Lit and yet nothing.