Search Unity

Question On supporting DOTS Deformation Motion Vectors

Discussion in 'Graphics for ECS' started by DreamingImLatios, Jan 24, 2023.

  1. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    Perhaps some of these questions I'm asking may be better suited for other graphics subforums. But what prompted this is the awkward state of this feature, and me evaluating whether or not I want to provide full shader compatibility.

    I have a custom skinning and rendering solution, and unlike Entities Graphics, I perform culling before skinning. This means that for motion vectors, I don't always have a previous frame's deformed mesh hanging around. Instead, I keep a history of the bone transforms (I needed it for inertial blending anyways) and skin the mesh in the previous frame's pose. It would greatly simplify my solution if I could put both the present and previous skinned meshes in the same graphics buffer (not bone-interleaved, just the same buffer). But the DOTS deformation shaders seem to bind two separate buffers.

    First question, is it legal to bind the same buffer to two separate global uniforms in a shader as readonly? It is surprisingly difficult to find info on this because it is one of those "why would you ever do that?"

    And if not, I noticed a comment by DeformedMeshIndex that suggests there are plans to split the component up in the future. What is the status of those plans? And what would the result look like?
     
    apkdev likes this.
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    As far as I know, it should be legal to use the same buffer for several uniform buffer bindings at once. Problems happen if you try to mix read-only with read-write.
     
    DreamingImLatios likes this.
  3. Jebtor

    Jebtor

    Unity Technologies

    Joined:
    Apr 18, 2018
    Posts:
    115
    No changes to DeformedMeshIndex have landed yet (or are in the pipeline) nor do I expect them to change in the near term. I cannot share much as to what the changes would look like either.
     
    DreamingImLatios likes this.
  4. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    I appreciate the answers. As long as the multiple bindings work, I should be able to make things work. I'll at least give it a shot.
     
    Jebtor likes this.