Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Provide motion vector to deforming mesh renderer

Discussion in 'High Definition Render Pipeline' started by Qleenie, Nov 29, 2023.

  1. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    832
    Hi, I'd like to render a deforming mesh to a mesh renderer, and would like to also provide motion vectors, similar to "skinned motion vectors" in SkinnedMeshRenderer.

    Is this possible to do this? I only see options for object or camera motion vectors. My deformation and motion vectors get calculated in a Compute Shader.
     
  2. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    832
    Found a way to do it, don't know if this is the simplest way:

    - Set compute buffer to material,
    - add custom function node in shader graph,
    - read buffer in custom function, write to Velocity Input of Vertex Stage (after turning on "Add Custom Velocity"), and
    - turn "custom vector for vertex animation" on in Material.

    Is there an easier way?