こんにちは!悠です。
今回は「Stable Diffusion WebUI」を使って、簡単に複数キャラを作成できるプロンプトと、キャラ毎に髪型や服装といった属性を指定できる拡張機能「Latent Couple extension (two shot diffusion port)」の使い方を紹介していきます。
Google Colaboratory版とローカル版のどちらでも使えるので、ぜひ参考にしてください!

それでは早速いってみましょう。
複数キャラを作成できるプロンプト
まずは拡張機能を使わずに、簡単に複数のキャラを作成できるプロンプトを紹介していきます。
代表的なものとして、次のようなプロンプトがあります。
- 2girls
- multiple girls
- couple
- face to face
- cheek to cheek
- kiss
- yuri
このうち特に2girls、couple、face to faceは効果が高い印象ですね。具体例を紹介します。
使用したモデルやLoRA、プロンプトは次の通りです。
- Model: chilloutmix_NiPrunedFp32Fix
- LoRA: KoreanDollLikeness, tifaMeenow_tifaV2
- embeddings: EasyNegative
- Clip skip: 2
- ENSD: 31337
- Steps: 20
- Sampler: DPM++ SDE Karras
- CFG scale: 7
- Denoising strength: 0.4
- Hires upscale: 1.5
- Hires steps: 20
- Hires upscaler: ESRGAN_4x
【その1】ほほをくっつける構図
masterpiece, best quality, ultra high res, (photo realistic:1.4), 2girls, multiple_girls, couple, face to face, yuri, casual jeans, red top, medium breasts, cleavage, lustrous skin, very long hair, blonde hair, looking at viewer, detailed background, intricate background, <lora:koreanDollLikeness_v15:0.3>, <lora:tifaMeenow_tifaV2:0.4>,
(worst quality:2), (low quality:2), (normal quality:2), lowers, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, nsfw, ugly face, fat, missing fingers, extra fingers, extra arms, extra legs, watermark, text, error, blurry, jpeg artifacts, cropped, bad anatomy
【その2】キスをしている構図
masterpiece, best quality, ultra high res, (photo realistic:1.4), 2girls, multiple_girls, couple, face to face, yuri, ((kiss)), closed eyes, casual jeans, red top, medium breasts, cleavage, lustrous skin, very long hair, blonde hair, looking at viewer, detailed background, intricate background, <lora:koreanDollLikeness_v15:0.3>, <lora:tifaMeenow_tifaV2:0.4>
(worst quality:2), (low quality:2), (normal quality:2), lowers, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, nsfw, ugly face, fat, missing fingers, extra fingers, extra arms, extra legs, watermark, text, error, blurry, jpeg artifacts, cropped, bad anatomy
プロンプトのみで複数キャラの属性を設定するのは難しい
上で紹介したプロンプトを使うと複数キャラは生成しやすくなるんですが、例えば「右の子は金髪ツインテール、左の子は赤髪ショート」といったように、キャラ毎の属性を設定するのは至難の業です。
例えば下のRedditの記事のように「2girls, one is A, one is B」と設定して試してみても、再現性はあまり高くありませんでした。
Prompt help: generating 2 people with different appearances in the same image
by u/Zyin in StableDiffusion
そこで役に立つのが、複数のキャラクターの描き分けができるようになる拡張機能「Latent Couple extension」です。
拡張機能「Latent Couple extension」の導入
ローカル版の場合
「Extensions」→「Install from URL」の「URL for extension’s git repository」に下記のURLを入力しInstallをクリックしましょう。
https://github.com/opparco/stable-diffusion-webui-two-shot
なお、「Error loading script: two_shot.py」というエラーが表示されて起動できない場合は、Stable Diffusion WebUIをアップデートする必要があります。
アップデート方法に関しては下の記事で紹介しています。

Google Colaboratory版の場合
下記の方法で紹介している「maintained by Akaibu」のノートブックを使って、拡張機能「Latent Couple extension」を導入していきます。
まだご覧になっていない方は、まず最初にこちらを準備しておいてください。


Google Driveからモデルデータを読み込むセルの下に新しくセルを作成し、下記のコードを入力してください。
#%cd /content/stable-diffusion-webui/extensions/ !git clone https://github.com/opparco/stable-diffusion-webui-two-shot /content/stable-diffusion-webui/extensions/stable-diffusion-webui-two-shot %cd /content/stable-diffusion-webui
拡張機能「Latent Couple extension」の設定
インストールが完了したら、txt2img中にLatent Coupleのタブが表示されます。
クリックして開き、Enabledにチェックを入れましょう。
次にDivisionsとPositionsの値を変更して、プロンプトが生成される領域を設定していきます。
左右に2人のキャラを生成したい場合は、
- Divisons: 1:1,1:2,1:2
- Positions: 0:0,0:0,0:1
3人のキャラを並べて生成したい場合は、
- Divisons: 1:1,1:3,1:3,1:3
- Positions: 0:0,0:0,0:1,0:2
と入力しましょう。
Weightsは各領域に使用されるプロンプトの比重ですね。初期値の0.2,0.8,0.8(0.2,0.8,0.8,0.8)で特に問題ありません。
設定し終わったらVisualizeのボタンを押すと、これまでに設定した領域が視覚的に表示されるので、自分の使いたい領域と比べて間違っていないか確認しましょう。
問題ないようならApplyを押して処理を確定します。
具体例(プロンプトあり)
では「Latent Couple extension」を使って、実際にイラストを生成していきましょう。
試しに左側に金髪ツインテールの女の子、右側に黒髪ショートの女の子を生成してみます。
「Latent Couple extension」では、「(背景のプロンプト)AND(左のキャラのプロンプト)AND(右のキャラのプロンプト)」のように、AND構文を使ってポジティブプロンプトを設定していきます。
masterpiece, (photo realistic:1.4), 2girls, (face to face), ((classroom)) AND masterpiece, (photo realistic:1.4), 2girls, (face to face), ((twintails)), ((blonde hair)), medium breasts, very long hair, looking at viewer, maid costume AND masterpiece, (photo realistic:1.4), 2girls, (face to face), (short hair), black hair, medium breasts, looking at viewer, school uniform,<lora:koreanDollLikeness_v15:0.3>, <lora:tifaMeenow_tifaV2:0.3>
(worst quality:2), (low quality:2), (normal quality:2), lowers, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, nsfw, ugly face, fat, missing fingers, extra fingers, extra arms, extra legs, watermark, text, error, blurry, jpeg artifacts, cropped, bad anatomy
AND構文の注意点
2人キャラを作る際のプロンプトを「A AND B AND C」とすると、AND構文を使う際は下記の点に注意する必要があります。
- masterpiece等の品質系のプロンプトはA,B,Cの全てに入れる。
- 2girlsのように人数を指定するプロンプトはA,B,Cの全てに入れる。
- 背景に関するプロンプトはAに入れる。
- LoRAの比重は一番最後に付けるだけでいい。
まとめ
以上が「Stable Diffusion WebUI」を使って、簡単に複数キャラを作成できるプロンプトと、キャラ毎に髪型や服装といった属性を指定できる拡張機能「Latent Couple extension (two shot diffusion port)」の使い方を紹介した記事でした。
アニメイラスト系のモデルデータなら、左側に鏡音リン、右側に鏡音レンみたいにキャラ毎に分けて登場させることもできるようです。
イラスト生成の表現の幅が広がるので、ぜひ試してみてくださいね!
では、ここまで読んでいただきありがとうございました。
コメント