ジャンプ先: 概要. 戻り値. キーワード. フラグ. MEL 例.

概要

bakeDeformer [-colorizeSkeleton boolean] [-dstMeshName string] [-dstSkeletonName string] [-maxInfluences int] [-srcMeshName string] [-srcSkeletonName string]

bakeDeformer は、取り消し可能、照会不可能、および編集不可能です。

デフォーマのセットによってメッシュ シェイプが決定されたリグ キャラクタを基に、bakeDeformer は観測されたデフォメーションに最も近いリニア ブレンド スキン ウェイトを計算します。そのために、可動域内でリグを移動することによってサンプルのテスト セットを生成します。結果のメッシュとポーズのペアは、スキニング ウェイトを計算して、制限された最適化を計算するために使用されます。bakeDeformer は、算出されたウェイトを自動的にバインドして目的のジオメトリに適用します。ソースと目的のメッシュ/スケルトンが同じ場合、このコマンドは、元のデフォメーションを skinCluster および計算されたウェイトで置き換えます。サンプルの使用方法については、次の例を参照してください。

戻り値

stringBakeDeformer 名

キーワード

bake, skinning, deformer

フラグ

colorizeSkeleton, dstMeshName, dstSkeletonName, maxInfluences, srcMeshName, srcSkeletonName
ロング ネーム(ショート ネーム) 引数タイプ プロパティ
-colorizeSkeleton(-cs) boolean create
作成された新しいスキン クラスタは、そのスケルトンが色付けされます。
-dstMeshName(-dm) string create
目的のメッシュ名。
-dstSkeletonName(-ds) string create
目的のスケルトン名。
-maxInfluences(-mi) int create
頂点ごとのインフルエンスの最大数。
-srcMeshName(-sm) string create
ソース メッシュ名。
-srcSkeletonName(-ss) string create
ソース スケルトン名。

フラグはコマンドの作成モードで表示できます フラグはコマンドの編集モードで表示できます
フラグはコマンドの照会モードで表示できます コマンド内でフラグを複数回使用できます。

MEL 例


proc string[] createJointsAndMesh(float $offset[])
{
    string $root = `joint`;
    joint; move -r 0 2 0;
    joint; move -r 0 2 0;
    joint; move -r 0 2 0;
    joint; move -r 0 2 0;
    joint; move -r 0 2 0;

    string $meshes[] = `polyCube -sx 3 -sy 10 -sz 3 -h 10`;
    move -r 0 5 0;

    select -r $root $meshes;
    move -r $offset[0] $offset[1] $offset[2];
    select -cl;

    return {$root, $meshes[0]};
}

proc bindMesh(string $object[])
{
    string $rootJoint = $object[0];
    string $mesh      = $object[1];
    select -r -hi $rootJoint;
    select -add $mesh;
    SmoothBindSkin;
    select -cl;
}

proc randomizeJoints(string $object[])
{
    string $rootJoint = $object[0];
    select -r $rootJoint;
    pickWalk -d down;
    for ($i=0; $i<4; $i++)
    {
        float $rads[] = `sphrand 1.`;
        rotate(
            rad_to_deg($rads[0]),
            rad_to_deg($rads[1]),
            rad_to_deg($rads[2]));
        pickWalk -d down;
    }
}

proc matchRotations(string $src, string $dst)
{
    select -r -hi $src;
    string $srcChain[] = `ls -sl`;

    select -r -hi $dst;
    string $dstChain[] = `ls -sl`;

    for ($i=0; $i<5; $i++)
    {
        select -r $dstChain[$i] $srcChain[$i];
        MatchRotation;
    }
}

{
    // Create an empty scene
    file -f -new;

    // Create two joint chains/meshes
    string $object1[] = createJointsAndMesh({0, 0, 0});
    string $object2[] = createJointsAndMesh({5, 0, 0});

    // Bind one of the joint chains to the mesh and rotate the weights
    bindMesh($object1);
    randomizeJoints($object1);

    // Use bakeDeformer to learn and apply the linear blend skinning weights.
    // Specify the source/destination skeletons and meshes and the number of maximum influences.
    bakeDeformer
        -ss $object1[0] -sm $object1[1]
        -ds $object2[0] -dm $object2[1]
        -mi 3;

    // Match the rotations of the two chains to show the results are similar
    matchRotations($object1[0], $object2[0]);
}