Skip to content

Commit d922729

Browse files
committed
Add readme
1 parent 43a8603 commit d922729

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

Images/generate.png

5.11 KB
Loading

Images/generate_result.png

72.9 KB
Loading

Images/generate_window.png

22.1 KB
Loading

Images/project_settings.png

74.4 KB
Loading

Images/setup.png

6.05 KB
Loading

README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Stable Diffusion Unity Tools
2+
3+
## Summary
4+
5+
Editor utility to generate assets in Unity Editor via self-hosted & managed Stable Diffusion installations
6+
7+
## Installation
8+
9+
1) Setup Stable Diffusion on your local machine - https://github.com/CompVis/stable-diffusion (skip if you will use managed services)
10+
2) Add package in Packages/manifest.json:
11+
```
12+
"com.konh.stable-diffusion-unity-tools": "https://github.com/KonH/StableDiffusionUnityTools.git?path=Packages/com.konh.stable-diffusion-unity-tools"
13+
```
14+
3) Click **SD Tools/Setup**, it creates settings file<br/>
15+
![](Images/setup.png)
16+
4) Open settings at **Edit/Project Settings/Stable Diffusion** and configure:
17+
- **Command** - command to execute stable diffusion:
18+
- Should contain required placeholders: `$PROMPT` for generation prompt, `$OUT_DIR` for destination directory, `$WIDTH` and `$HEIGHT` for image dimensions (these arguments assigned at generation process)
19+
- Could be multiline for better usability, line breaks are ignored
20+
- Windows WSL example (in that case paths should be related to Linux file system): `wsl
21+
--cd "linux-mnt-path-to-stable-diffusion"
22+
python3 scripts/txt2img.py
23+
--prompt "$PROMPT" --plms --n_samples 1 --n_iter 1 --outdir "outputs/txt2img-custom/$GUID"`
24+
- If you want to use managed service - write custom script which communicate with it and store results on file system in txt2img.py compatible format
25+
- **ResultPath** - full path to directory with generated files on local file system (in case of WSL - Windows host machine)
26+
![](Images/project_settings.png)
27+
5) Additionally, you could add **Assets/StableDiffusionUnityTools** to .gitignore (it's related to current machine, unfortunately we can't use UserSettings for that)
28+
29+
## Asset file generation
30+
31+
Now you can use **SD Tools/Generate Image** to generate images, it provide you ability to tweak settings for next generation:
32+
- Required settings: **Prompt**, **Directory**, **Width**, **Height**
33+
- Optional settings: **Name** (if not assigned, GUID is used)
34+
![](Images/generate_window.png)
35+
36+
When generation finished, you will see result in given directory
37+
![](Images/generate_result.png)

0 commit comments

Comments
 (0)