This shader will encode a vector representing the motion of the object in the Red and Green components. The following two images illustrate the effect. The first image shows the original scene with motion blur rendered normally. The second shows the false-color effect of the motion vector.
To use this shader correctly, you must enable Instantaneous Shutter For Motion Vectors (Motion Blur settings).
The vector won't be normalized.
Sample time for shutter start.
Sample time for shutter end.
When greater than 0, this is the maximum amount of screen-space motion. The motion vector encoded in the RG components is then normalized to this value. This is better when writing to 8 or 16-bit formats like JPEG, TIFF, etc. On the other hand, when this value is less than or equal to zero, magnitude encoding is used instead: RG holds the unit direction vector, and B holds the magnitude. This is better when writing to floating point formats (EXR etc.).