边缘世界 RimWorld

边缘世界 RimWorld

229 个评价
AI-gen portraits made easy
由 bolphen 制作
If you ever wondered how people make AI-gen portraits of their colonists, this guide will show you how to easily create them, in a consistent style, with almost no setup.
4
5
6
5
2
3
2
2
   
奖励
收藏
已收藏
取消收藏
Intro
Note. The newer versions of the mod have built-in functionalities for AI-gen, which should be a lot more convenient to use. Please check out this guide on how to set it up. The current guide is still useful if you don't mind doing the generations manually.

If you ever wondered how people make AI-gen portraits of their colonists, this guide will show you how to easily create them, in a consistent style, with almost no setup.

You will be able to produce portraits just like these yourself by the end of the guide ^^
Make an avatar
To get consistent portraits, we use the avatars from my mod avatar and feed them to AI as reference; this allows the end results to have a consistent look, while also saves you some manual labor to provide detailed descriptions of your colonists, and spares some computational resources as well. You can see how they serve as an intermediate step between the vanilla blobs and the final portraits.

Of course you could also use the vanilla portraits as reference, or even just use text prompt alone without a reference image. But then getting a desired result would require a lot more effort and tweaking.

So the first step is to install the mod ^^
https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=3111373293
Once you enabled the avatar mod, an avatar will show up above the info tabs when you select a human pawn (the mod does have some extra features, like integration to the colonist bar, feel free to check them out). Right click on the avatar and save the upscaled version.


The picture will then be saved to your RimWorld user data folder, where your save files can also be found (see wiki[rimworldwiki.com] for more details). Depending on your OS, this would be
  • Windows: %USERPROFILE%\Appdata\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\avatar
  • Linux: ~/.config/unity3d/Ludeon Studios/RimWorld by Ludeon Studios/avatar/
  • macOS: ~/Library/Application Support/RimWorld/avatar/
Generate the portrait
Next we need an AI instance to produce the portraits. If you have a fancy GPU setup, you probably already know how to proceed. For people with a potato laptop like me, there's a marvelous site https://pixai.art (thanks octogiraffe!) where you can sign up for free (with a fake email address and use the limited daily free quota; and if you don't mind making a lot of new accounts or waiting a bit for each image, you basically have unlimited usage).

Once you signed up with your totally legit email and logged in, you should be presented with the "Image Generator" interface, where you have a text prompt to type in.


Upload the avatar that we just got. Fill in the text prompt with a basic description of your colonist. For example, I would simply put
female front portrait, dark skin, dark hair, ponytails, blue t-shirt

On the right hand side, you can pick your choice of the model, which determines the style of your portrait. A lot of them are anime styles, but there are some realistic ones as well as a few more western comics/cartoon-like ones. I'll use one called Real Cartoon 3d.


Then simply click "Let's Go!" to launch the AI (you will notice that the credit cost is reduced to 600, because we provided a reference image, which saves some computational resources; if you uncheck the "High Priority" option, it'll actually cost 0 credit, essentially granting you infinite usage, though you do need to wait a while before seeing the result).

And there you go!
Styling
There are a lot of ways to stylize the portraits. Especially if you are into anime styles.

For people who find the anime/cartoon-style portraits a bit too pretty and generic, here are a few tips I discovered to make them look more ordinary and realistic.

On pixai.art there is a model available called PixaiDiffusion(CG), which is the first one listed in the right panel (...). As I understand it, this is a more general-purpose model that's trained on many different art styles instead of a particular (anime) one. And it behaves like the visual version of Randy Random. It generates the portraits in many random art-styles and adds a lot of variety and personalities to the pawns.
It's apparently also more capable at understanding the prompt, so here the stellic crown is not interpreted as "normal crown wearing over blonde hair". Which means you are also free to add more descriptions like "ugly", "angry", "old", "depressive", as traits of the colonists.

Now comes the neat part. It's possible to combine the two styles and get the best of both worlds. Once you make a nice arty portrait using PixaiDiffusion, you can pass that picture as the reference image, and use another model that excels at adding details. I recommend one called noosphere_v3. Note that you do need to lower the strength of the new model to avoid it overwriting too much.
Here I first pass the pixel-art avatars into the PixaiDiffusion model, with a strength of 0.55. Then I pass the result to the noosphere_v3 model, with a strength of 0.45. The results now look more stylish and individualized, instead of all having the face of a super-model.
Epilogue
That's it. Have fun tweaking the models and settings to find a style that you like!

Note. With the last update (thanks to Tiago), you can replace the pixel-art avatar with the AI-gen one: right clicking on the avatar will have the option "Enable static portrait", which creates a png file named like "Tynan_Sylvester_123.png" in the avatar directory. This will be the static portrait displayed for your pawn in place of the pixel-art one. You can replace it with the AI-gen portrait or any image you like, and it'll get updated in-game automatically.

Another useful tip: if you disable the background of the avatar in the mod settings, the AI-gen portrait will have (almost) black background, which can then be easily removed to get a transparent background, like in the screenshot above.

Disclaimer. I'm in no way affiliated with pixai.art (or I wouldn't be teaching you how to cheese its credit system), it's just the first one I found that actually works quite well. There are probably also other websites out there that you can use. For example, https://dezgo.com/image2image also works very well and doesn't even require registration.
40 条留言
costelo 4 月 23 日 下午 5:25 
Doesn't work for me, I get the "ai gen process failed to start" message. I've double checked everything for "spelling" errors, the token, model codes etc. and nothing
bolphen  [作者] 2024 年 4 月 6 日 上午 3:39 
@Cook1981 yeah pigskins are a bit tricky, probably depends on the model that you are using (maybe there are some lora that can help)

btw if you are using pixai.art I'd recommend trying out the new interface following the steps I described in the previous comments. You can do portraits directly in-game like this https://imgur.com/UDRQU6Y
Cook1981 2024 年 4 月 5 日 下午 7:53 
Quick question, I've tried everything to get that ai program to generate a pig nose for my pig character but can't seem to figure out a prompt to achieve it. I'll probably end up drawing my own portraits now that I know you can replace the portraits, but figured I'd ask since I did successfully replicate my human colonists
bolphen  [作者] 2024 年 4 月 4 日 上午 12:11 
[continued]

Now right click on the main avatar will give you the option to generate using AI, and you can edit the prompts before launching the task. Once the generation completed and the image retrieved, it will automatically show up in-game.

And the advantage is that if you want to use local instance of SD or something else, all you need is to write a script that uses the same syntax.

Let me know if it's working for you :)
bolphen  [作者] 2024 年 4 月 4 日 上午 12:11 
@Red007Master I made an implementation, and here's how it works: you provide the Avatar mod (in the settings) the path of an executable that accepts a png and some prompts, which then repaints and replaces the image with AI-gen. The executable should work like [code]repaint image.png "some prompts"[/code]

So if you (or any one else) want to try it:
- first switch to the latest version of Avatar on github.
- then clone this repo https://github.com/bolphen/pixaiAPI this uses the pixai.art api to do img2img. We'll use the repaint.py as the executable (so make sure it has the right permission). There are a few options that you can edit. I used a throwaway account on pixai.art. You can always register new accounts and then enable "high_priority" to allow faster generation.
- finally go into the settings of Avatar, and put in the full path of repaint.py.
Red007Master 2024 年 4 月 3 日 上午 3:14 
@bolphen About prompts: Only problem is promps can difer from model to model (depended on how model was trained)
Red007Master 2024 年 4 月 3 日 上午 3:06 
@bolphen I think that for now our best choice is to use Automatic's 1111 Webui (API that it provides) it's easy to install on both Linux and Windows.

An as @Stubkan mentioned we need to find fitting model/models for our needs.
Red007Master 2024 年 4 月 3 日 上午 2:49 
@bolphen Only now spotted your response, let's continue or conversation in Discord/DM.

Yep Google Colab is good idea, my GTX1070 can run SD but it is tooo weak for training and stuff so i use it.

I to don't have much time lately, but i will do some kind of proof of concept.

You can DM/Discord/Mail me. Discord - red007master.
Rat 2024 年 3 月 19 日 下午 9:39 
cringe
just pick up a pencil
Indigo Cactus 2024 年 3 月 6 日 下午 3:01 
The site I tend to use is Dezgo, lots of good models with or without paying. Thanks for this guide though, maybe I'll cook some portaits up...I really like the mod!