I was hoping you would say from a flipbook since that is all I have working. You may be able to devise a new system based on how this works since the basic ideas will be the same. The one thing you are going to figure out for yourself is how to get the objects next frame position, and how you are going to store all of the motion vectors into a texture. In my case those problems were easy since I was dealing with a flipbook, every frame is already part of an atlas and took advantage of that by using the same layout.
Here is how I generate motion vectors alongside a flipbook animation:
On the bottom is the array of flipbook meshes, each with a different rotation. On the top, the flipbook array is repeated, but each mesh gets unwrapped using its lightmap UVs, and centered inside of its local flipbook cell. I replace the material emissive color with local worldposition, which is worldposition centered within each flipbook cell and then biased into the 0-1 range so that regular 8bit textures can be used without requiring floatHDR textures.
This is all set up and working in the RenderToTexture_LevelBP, under Flipbooks. The associated materials may be useful for you to reverse engineer.
At this stage, motion vectors are calculated by capturing the top UV layout image using a render target, and then reading current frame and frame+1 and getting the difference and transforming that difference from world to screen space. I also expose a “motion vector intensity” parameter which boosts the difference to get better precision with 8 bit textures. I just increase it until it clamps out (which I can tell by using an IF node to make the color red in that case). That means you need to specify the same amount as a divisor in your final material that reads the motion vectors.
The ‘motion substepping’ part helps the shapes be able to blur outside of their original silhoutte.
For example, with our current flipbook motion vectors, it will look like this:
Notice that we only have motion vectors within the silhouette of any given frame. That means that we will get the expected blending only where the silhouettes over N and N+1 overlap.
In order to fix that, we actually have to render a constant gradient from each pixels source to its destination in the next frame. That looks like this:
This is accomplished by actually re-adding all of the flipbook meshes for each “substep”, with an offset Z value, and with animation phase that blends between N and N+1.
For example, if we did 4 substeps, it would add 4 new frames behind just N:
N
N + 0.25
N + 0.5
N + 0.75
N + 1
So we rendered 4 additional meshes to substep 4 times. In my example this is 32 substeps (altho it might be 64 I cant remember), and it causes lots of meshes to be added and thus can take a second to refresh when increasing the substeps:
For information on how the motion vectors are applied, there is a material function called “Flipbook_MotionVectors” in engine.