This section describes which types of motion different shaderA program that runs on the GPU. More info
See in Glossary types support for calculating motion vectors.
URP supports motion vectors only for opaque materials, including alpha-clipped materials. URP does not support motion vectors for transparent materials.
URP Lit
, Unlit
, Simple Lit
, Complex Lit
, and Baked Lit
shaders support per-object motion vectors for the following motion types:
To enable alembic motion vectors for particular material, enable the Alembic Motion Vectors checkbox in the Advanced section of the material inspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary.
Note:: Use materials with the Alembic Motion Vectors checkbox enabled only on alembic vertex animation caches rendered with a PlayableDirectors component. When using such materials with regular draw calls and MeshRenderers, the materials cannot read the correct motion vector attribute stream, which results in incorrect motion vectors.
The URP Shader Graph Lit
and Unlit
targets support all of the motion vector features described in the URP ShaderLab shaders section. In addition to that, they have the Additional Motion Vectors setting with the following options:
Time-Based: motion vectors for a Shader Graph vertex animation are generated automatically by running the vertex position subgraph twice with the current and the previous frame values for the Time node. This mode only works correctly for vertex animations that are computed procedurally based on the Time node, and that use only user-defined parameters (constants, attributes, buffers, textures) that do not change between frames.
Custom: selecting this option adds an extra Motion Vector vertex output. The output lets you specify a custom object motion vector: a 3D local object space offset for each vertex from where it was in the previous frame. If you know how to compute the position of a vertex in the previous frame, you can author custom motion vectors for your vertex animations. Unity applies the custom motion vectors additively to transform motion, skeletal animation, and alembic animation before projecting the motion vector to the final 2D screen space vector.
None: the default value. Use this option when the shader either does not modify the vertex output or if it does not animate the vertex deformation.
The options Time-Based and Custom enable the MotionVectors pass on the materials. The object motion vector pass is rendered every frame for them, even when the object’s transform is stationary between frames, unless the MotionVectorGenerationMode property is set to Camera
.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.