Misleading Nature of GetPreviousVertexBuffer()

Hi everyone!

I ran into something that took me a while to figure out, so I thought I’d share it in case it helps someone else.

I found that if the render pipeline is not rendering motion vectors, GetVertexBuffer() and GetPreviousVertexBuffer() both return the same underlying skinned vertex buffer, even with skinnedMotionVectors enabled.

For example, in URP the previous skinned vertex buffer only starts working once you have DrawMotionVectors stage, such as by enabling Motion Blur in Camera And Objects mode or by adding a custom render pass that explicitly requires _MotionVectorTexture.

Without that, both methods return the same buffer.

What caught me off guard is that the documentation for GetPreviousVertexBuffer() only mentions enabling skinnedMotionVectors. It doesn’t mention that the pipeline must also be generating motion vector texture.

This may think that this is obvious, but it’s not that simple, especially for technical artists. Your pipeline may not need _MotionVectorTexture, but may still need GetPreviousVertexBuffer(). Your effect might work entirely in object space or world space—for example, vertex smearing, mesh deformation, or any GPU effect based on previous-frame vertex positions.

So if you’re implementing something like this, make sure that the DrawMotionVectors stage is always executed by your render pipeline, or else you’ll need to maintain your own previous-frame vertex buffer by copying the current vertex data every frame.

Hopefully this saves someone’s time.

Thanks!

Hi, thank you for pointing this out. We’ve improved the documentation for SkinnedMeshRenderer.GetVertexBuffer and SkinnedMeshRenderer.GetPreviousVertexBuffer. We hope these updates will help anyone using these APIs in the future. Please allow some time for the updated documentation to be published.