Range of Motion Vectors

Hello, currently, I’m working on a project with Unity’s motion vectors. I’m reading the raw vectors from the texture and write these in a separate file. Can someone tell me in what range these vectors are? It seems that the vectors are in the range of -1 and 1 but what is the normalization term? Is U divided by the screen resolution width and V by the height? Under this assumption, the final pixel offset is a result of U * width and V * height but the result seems to be wrong when the camera moves, too.

I’ve tried to visualize the problem in the attached image.

It would be nice if someone can give me some more details about motion vectors because I can’t find something in the docs.

Thank you!

Motion vectors are simply the screen space velocity of pixels between frames and are stored in 16-bit floating point, so there isn’t actually any normalization. If a pixel is already on screen (i.e. between [0,1] in screen space) then its velocity will be somewhere in the range of [-1,1] depending on the direction of motion. However, if something was offscreen in the previous frame, then the motion vectors can actually be well outside that range.

If you needed to normalize these vectors to store in an image file then you would probably want to convert the bits to from floating point to integer (by using something like asuint()).