[API Behaviour Breaking Change] Don't change raw blendshapes immediately when calling Vrm10RuntimeExpression.SetWeights()
#2130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
現在
Vrm10RuntimeExpression
のSetWeights()
SetWeightsNonAlloc()
SetWeight()
は呼び出すと即時、Expression の設定に従ってSkinnedMeshRenderer
の BlendShape 等が変化するように反映します。この挙動は直感的に思えますが、実は他の Vrm10 要素と一貫性がなく、なによりパフォーマンスボトルネックになっています。
一貫性の無さとして
ControlRig
Constraint
LookAt
の他の Vrm10Runtime 要素は即時反映ではないことが挙げられます。これらはデフォルトでは LateUpdate で呼び出される
Vrm10Runtime
のProcess()
において反映されます。UniVRM/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10Runtime.cs
Lines 187 to 203 in 4621d51
またパフォーマンスボトルネックとしては、1フレーム中において
Vrm10RuntimeExpression.SetWeights()
を呼び出したとき」Vrm10Runtime.Process()
が呼び出されるとき」の 2 回、反映処理が走ってしまうことがかなりネックになっています。
今回の挙動変更を行うことで、次のような変化が起きます。
Vrm10RuntimeExpression.SetWeights()
呼び出しタイミングがVrm10Runtime.Process()
の実行よりも遅い場合