Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Feedback Now that we have new GetBindposes in 2022.2, How about SetBindposes?

Discussion in '2022.2 Beta' started by nishikinohojo, Aug 13, 2022.

  1. nishikinohojo

    nishikinohojo

    Joined:
    Aug 31, 2014
    Posts:
    46
    I would like to SetBindposes with NativeArray<Matrix4x4>.

    NativeArray version of GetBindposes() seems to give us direct pointer of the buffer but its length is fixed to existing bindposeCount.
    It will not work with runtime generated mesh because old .bindposes property is probably the only way to change bindposeCount dynamically. And it is inefficient.

    Tnanks!

    Edit:
    I could not find out how bindposeCount is determined for runtime-generated mesh in the document.
    But if bindposeCount is automatically calculated when all bone indices decided like by calling
    SetBoneWeights(NativeArray<byte> bonesPerVertex,NativeArray<BoneWeight1> weights), it is enough for my use case.(I will check that when I have time)
    But even if so, it is very unclear. Either way, to replace bindposes property properly, SetBindposes should exist, I suppose.
     
    Last edited: Aug 13, 2022
    joshcamas and adamgolden like this.
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,299
    Hey, you're absolutely right.

    I added GetBindposes in 2022, but failed to add the setter that takes a NativeArray too.
    I'm adding it right now - but it won't appear until Unity 2023.

    Thanks for reporting it!
     
  3. nishikinohojo

    nishikinohojo

    Joined:
    Aug 31, 2014
    Posts:
    46
    Thanks a lot! I've almost given up it.
    Actually I did avoid this problem by having bindposes by myself, but it was possible because I have written entirely custom solution for animation-skinning and asset definitions like mesh. It is not a normal way to avoid this issue so I am glad to have such a common solution for this problem.

    Anyway, I really do appreciate the fact that you guys doing very well to make us achieve high performance things recently.
     
    richardkettlewell likes this.
  4. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    268
    Would it be possible to get these bindpose APIs on MeshData in 2023 as well? It's often the one thing I have to jump back onto the main thread for when processing mesh data.
     
  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,299
    Thanks for the additional feedback!

    I've discussed this with the team that looks after the mesh api, and they are planning improvements to expose access to all skin weights, blend shapes etc, but this task is still being designed/discussed, so we're not going to add this method into the MeshData until the team have fully decided how the larger api changes should look.

    But it will be coming at some point :)