0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

レイヤー分けした PSD 1 枚からゲームモンスターの戦闘アニメ一式を Spine で作る(待機・攻撃・被弾・死亡)

0
Posted at

本記事は英語の原文 A game monster's combat set in Spine の日本語版です。翻訳には AI を使い、プロンプトは実際に送った英文をそのまま載せています。

RPG 用の溶岩サラマンダーを、レイヤー分けした PSD 1 枚から Spine 4.2 のスケルトンにし、戦闘アニメ 4 本(待機 idle・攻撃 attack・被弾 hurt・死亡 death)を付けました。リグとアニメは自作ツール Riggy のチャットで AI に作らせています。最初のプロンプト 1 つで、3 分足らずのうちにリグと 4 本すべてが出来上がりました。攻撃は一発で OK、被弾は 1 回の修正で OK。残りは主に死亡アニメの仕上げで、短いプロンプトとマウスでの微調整で詰めました。

この記事では、送ったプロンプトをそのまま載せ、そのたびに何がおかしかったか、どう直したかを順に書きます。途中で出てきた「パーツの親ボーン」「描画順」「地面の基準」などの落とし穴は、AI を使わずに Spine で作る場合にもそのまま当てはまります。

待機・攻撃・被弾・死亡

完成したリグは公式 Spine Web Player で動かせます:デモ。攻撃はヒットの瞬間に hit イベントを発火するので、ゲーム側はそのタイミングでダメージ判定できます。

用意したもの

パーツごとにレイヤーを分けた PSD。効いたのは次の 2 点です。

  • レイヤーを描画順に並べる。 上のレイヤーが手前に描かれます。横向きのキャラクターなら、手前の腕は胴体より上、奥の腕は胴体より下。
  • わかりやすい名前を付ける。 head、jaw、torso、arm_front_upper、thigh_back… AI は名前を読んで関節の位置を決めます。

サラマンダーはボーンなしの 16 レイヤーで読み込みました。

プロンプト 1:リグと 4 本のアニメ

This is a lava salamander warrior for an RPG, facing right, holding a stone club in the front hand. Rig it and make four animations; parts that touch must stay overlapped in every frame. idle - 2 s loop: heavy breathing, the head bobs slightly on the neck, the tail sways a little. attack - about 1 s: the club arm stays almost in place and lifts only a little; the work is in the wrist - the club cocks back and snaps forward; the torso leans into the blow and the legs bend slightly. Event 'hit' at the impact. hurt - about 0.5 s: a small recoil from a blow to the chest, then a light wobble of arms and legs that settles. death - about 1.5 s, starts from the rest pose: he staggers, the knees give way one after the other, he falls backwards in phases - not as a stiff board and not as a sack; the feet stay planted, the club slips out of the hand.

モデルは最初のボーンを置く前に素材の種類を「人型」と判断し、その種類用のレシピ(人型の関節はどこに置くか、攻撃はどう組むか、死亡は静止ポーズから始める、など)を読み込んでから、ボーン 19 本と 4 本のアニメを一度に作りました。頭は口元ではなく首で回り、攻撃は腕を大きく振り回さずに手首で振り抜きます。

待機・攻撃のため・ヒット・被弾

以降はアニメをコマ送りで確認しながら直しました。

プロンプト 2:被弾がぶれすぎ、死亡で地面に沈む

被弾で棍棒の腕が大きく振れすぎ。死亡ではよろめく間に体全体が左へ滑り、最後は地面の下に沈み、棍棒が空中に飛んでいきました。

idle and attack look good. Fix two things. death: in the stagger the whole body slides to the left, and by the end he sinks below the ground line - the legs and back go under y=0, and the club flies up into the air instead of falling. He must end lying on his back ON the ground line, nothing below y=0, feet where they stood; the club drops down and lands on the ground beside him. Please look at the frames of death before you answer. hurt: the club arm jerks too much on the hit - keep it to a few degrees, the recoil should come from the torso.

被弾はこれで完成:腕は数度しか動かず、のけぞりは胴体から。死亡は少し良くなりました。

プロンプト 3:死亡を秒単位で、手首の隙間も

死亡でまだ棍棒の腕が頭の上まで上がり、脚が地面を突き抜けます。拳と前腕の間に細い隙間があるのにも気づきました。これはアニメではなく絵の配置の問題です。

hurt is good now. death is still wrong, here is what I see: at 0.6-0.8 s the club arm swings up over the head - keep it down by his side. From 0.95 s the legs stay vertical and go under the ground line while the body tips over them; at 1.5 s the legs hang below the ground, the head is the lowest point on the left and the club floats in the air above him, away from the hand. Wanted end pose: he lies flat on his back along the ground line - head on the left, legs stretched out to the right, the feet near where he stood, nothing below y=0; the club lies on the ground next to the hand. One more fix in the setup pose: the fist with the club sits a bit apart from the forearm, there is a gap at the wrist - move hand_front together with the club about 14 px left and 8 px up so the fist sits on the end of the forearm.

セットアップポーズで拳を前腕の先に移したので、隙間は全アニメで同時に消えました。

プロンプト 4:待機に生気を、死亡は秒ごとに

待機の呼吸は良いものの、体全体がひとかたまりで揺れていました。死亡は問題ごとに時刻を書きます。

Much better - attack and hurt are approved, don't touch them. Small tuning only. idle: right now the whole body sways as one big piece - add a slight independent sway of both arms (2-3 degrees at the shoulder, a little behind the breath) and of the hips/thighs, so it feels alive. death, small fixes, keep the rest: (1) at 0.5-0.7 s both feet lift off the ground and the club arm bends up so the club is next to the head - keep the feet on the ground until the body tips, and keep the club arm low by the side; (2) from 1.0 s to the end the club sticks straight up into the air - lay it down so at 1.5 s it rests flat on the ground next to the hand; (3) at 1.3-1.5 s the back arm and the tail hang below the ground line - lift them so they rest on the ground, nothing below y=0.

マウス修正 1:付いてこない腰布

攻撃で胴体が前に倒れるのに、腰布はその場に残って腰からずれていました。腰布が腰(hip)のボーンにぶら下がっていて、胴体はその上で曲がっていたためです。ボーンツリーで loincloth を torso にドラッグするだけで解決。キャンバス上ではパーツは動かず、以後は 4 本すべてで胴体に付いていきます。無料で数秒です。

Spine 一般の教訓: 胴体に描かれたベルトや服は、腰ではなく胴体のボーンに付けるか、胴体の関節をベルトの高さに置く。

プロンプト 5:手前の腕が体の後ろに隠れる

左側の太い腕はモンスターの「手前の腕」なのに、レイヤーが胴体の下にあったため、被弾で体の後ろに滑り込んでいました。死亡では棍棒の腕が関節でばらけ、棍棒が拳から抜けていました。

Next round of small fixes. (1) Draw order: the big arm on the left of the picture (arm_back_upper + arm_back_lower) is actually his NEAR arm - in the original art it is in front of the torso, the back thigh and the loincloth. Right now it goes behind the torso, very visible in hurt. Move both of those parts above torso, thigh_back and loincloth (still below jaw and head). (2) death 1.0-1.5 s: the club arm falls apart - the fist separates from the forearm and the forearm from the shoulder, and the club slides out of the fist so the handle lies apart from the hand. Keep that chain joined: rotate only at the joints, no translate on arm_front_upper/arm_front_lower/hand_front/club; let him keep the club in the fist and land with it, club flat on the ground. (3) death 1.15-1.5 s: the near arm's forearm with the claws sticks out horizontally into the air to the right - lay it along the body. (4) at the end the near arm and the tail still dip a bit below the ground line - lift them onto it. attack, hurt and idle are approved, don't change their motion.

プロンプト 6:方向と数字をひとつ

Good progress: the draw order is right now, and the club arm stays in one piece with the club in the fist - keep both. Two things left in death, from about 1.1 s to the end: (1) the near arm (arm_back_upper + arm_back_lower) turned the wrong way - it now points past his head to the left and partly goes under the ground. Turn it the other way: lying on his back with the head on the left, the near arm should lie along his side pointing toward his feet (to the right), resting on the ground. The -138 degrees at the shoulder is the wrong direction; something like +40..+60 from rest should do. (2) the belly and the lower torso dip about 40 px below the ground line in the final pose - lift the whole body (fall translate) so the lowest point is on y=0. Nothing else changes.

短いプロンプトで、腕は体に沿って横たわり、体は地面に乗りました。

プロンプト 7 とマウス修正 2:脚

death is almost there, only the legs in the fall and the final pose (about 0.9-1.5 s): (1) the club-side leg (thigh_front, shin_front, foot_front): lower the thigh a bit toward the other leg, as if the legs close together; foot_front must not twist on its own - keep it at roughly its rest angle relative to the shin (offset near 0) all the way. (2) the other leg (thigh_back + shin_back) ends up sticking up into the air - by the end of the animation it should come back down to a natural relaxed pose, close to its rest angles relative to the body, lying next to the first leg. Everything else stays as it is.

最後のポーズで脚がまだ少しずれていた(片方は空中、片方は地面の下)ので、Motion モードで death の 1.15・1.25・1.4・1.5 秒の瞬間をクリックし、太ももをマウスで回して仕上げました。そのアニメのその瞬間のキーだけを直す操作で、無料です。

プロンプト 8 とマウス修正 3:地面はどこか

記事のレビューで 2 点見つかりました。死亡が静止ポーズから始まっていない(0 秒の時点で奥の太ももが 20° 回っている)。原因は自分たちが最後の瞬間に行ったマウス修正で、その太もものタイムラインは最初と最後の値が同じだったため、ループとみなされて最初のフレームにも修正がコピーされていました(ループしないアニメではこうならないよう直しています)。もう 1 つ、地面をキャンバスの下端で測っていましたが、このモンスターの足はそれより約 70 px 上に立っていました。

Last fixes in death, nothing else changes: (1) frame 0 must be exactly the rest pose - right now thigh_back starts already rotated by about +20 degrees at 0 s; make its death track start at 0 offset and keep its end pose as it is now. (2) at 0.2-0.9 s the knees bend but the hips stay where they are, so both feet lift about 70 px off the ground - lower the body together with the knee bend so the feet stay on y=0 until he tips over. (3) at 1.5 s the tail and the near upper arm (arm_back_upper) still dip about 20 px below the ground line - lift them just enough to rest on y=0.

フレーム 0 は静止ポーズに戻りました。ただし (2) は自分たちの誤り:足はもともと浮いていなかったので、体を下げたら足が床にめり込みました。静止ポーズの足元のラインを地面として、Motion モードで手作業で直しました(沈み込みを消し、着地時の体の高さを決め、着地の瞬間から尻尾と手前の腕を寝かせる)。これで足は倒れるまで地面に付いたまま、着地で軽く弾み、立っていたのと同じラインに横たわります。

死亡の 5 つの瞬間

Spine 一般の教訓: 地面は画像の下端ではなく、静止ポーズで足が乗っているライン。倒れるアニメの最終フレームはこのラインで確認する。

プロンプトを減らすコツ

  • 動きの名前だけでなく、動きを説明する。 「攻撃を作って」だと判断をすべてモデルに任せることになり、モデルは自分で考えます。長さ、どこが動いてどこが止まるか、どこから始まりどの順番か、何に似ているかを書く。上の攻撃プロンプトは一発で使えるものになりました。「heavy breathing」「falls backwards in phases — not as a stiff board and not as a sack」のように感触も書けます。
  • レイヤーの順番と名前を整える。 修正のうち 2 つ(手前の腕が体の後ろ、手首の隙間)はアニメではなく絵の問題でした。
  • OK になったものを伝える。 「attack and hurt are approved, don't touch them」で、どのアニメに触れないかがモデルに伝わります。ただしリグそのものの変更(パーツの親、描画順)は全アニメに効くので、そうした修正の後はもう一度確認を。
  • 秒と方向を言う。 「At 1.3–1.5 s the tail hangs below the ground line」は一度で直り、「死亡が変」は何往復もかかります。
  • 小さなことはマウスで。 親ボーンの付け替えや、ある瞬間のポーズ調整は数秒で済み、料金もかかりません。

この先

書き出しは標準の Spine 4.2 JSON とアトラスなので、Spine エディタで手作業で仕上げることも、そのままゲームに読み込むこともできます。Spine ランタイムでゲームを出すには、スケルトンを誰が作ったかに関係なく Esoteric Software の Spine ライセンスが必要です。

いまはレイヤー分け済みの PSD から始める必要がありますが、キャラクター画像 1 枚を、正しい順番・名前付きのレイヤーに分け、隠れた部分も描き足すツールを作っています。画像 1 枚から動くリグまで、Photoshop を開かずに行けるようにするのが目標です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?