# NSFW ComfyUI Workflows

Production-ready workflows for NSFW content generation using CivitAI models.

## Available Workflows

### 1. LUSTIFY Realistic Text-to-Image
**File:** `lustify-realistic-t2i-production-v1.json`

**Model:** LUSTIFY v7.0 GGWP (`lustifySDXLNSFW_endgame.safetensors`)

**Optimized Settings:**
- Sampler: DPM++ 2M SDE
- Scheduler: Exponential
- Steps: 30
- CFG Scale: 6.0
- Resolution: 1024x1024 (SDXL)

**Features:**
- Photorealistic NSFW generation
- Optimized negative prompts for LUSTIFY
- Professional photography quality
- Detailed skin texture and natural lighting
- Supports both danbooru tags and natural language

**Use Case:** High-quality photorealistic NSFW images focusing on women in various scenarios

**Example Prompt:**
```
A beautiful woman in elegant dress, photorealistic, professional photography, high quality, detailed skin texture, natural lighting, 8k, masterpiece, best quality
```

**Negative Prompt:**
```
(worst quality, low quality:1.4), illustration, 3d, 2d, painting, cartoons, sketch, open mouth, bad anatomy, deformed, blurry, watermark, text
```

---

### 2. Pony Diffusion Anime/Furry Text-to-Image
**File:** `pony-anime-t2i-production-v1.json`

**Model:** Pony Diffusion V6 XL (`add-detail-xl.safetensors`)

**Optimized Settings:**
- Sampler: Euler Ancestral
- Scheduler: Normal
- Steps: 35
- CFG Scale: 7.5
- Resolution: 1024x1024 (SDXL)

**Features:**
- Anime, cartoon, and furry NSFW generation
- Danbooru tag support (optimized for tags)
- Balanced content training (1:1:1 safe/questionable/explicit)
- 2.6M aesthetically ranked training images
- Versatile style support

**Use Case:** High-quality anime/cartoon/furry NSFW content with tag-based prompting

**Example Prompt (Danbooru Tags):**
```
1girl, solo, long_hair, breasts, smile, looking_at_viewer, anime style, high quality, detailed, masterpiece, best quality
```

**Example Prompt (Natural Language):**
```
Anime girl with long flowing hair, smiling and looking at viewer, detailed anime art style, high quality, masterpiece
```

**Negative Prompt:**
```
(worst quality, low quality:1.4), bad anatomy, deformed, blurry, watermark, text, signature, artist name
```

---

### 3. RealVisXL Lightning Fast Text-to-Image
**File:** `realvisxl-lightning-t2i-production-v1.json`

**Model:** RealVisXL V5.0 Lightning (`realvisxlV50_v50LightningBakedvae.safetensors`)

**Optimized Settings:**
- Sampler: DPM++ SDE
- Scheduler: Karras
- Steps: 6 (Lightning fast!)
- CFG Scale: 2.0
- Resolution: 1024x1024 (SDXL)

**Features:**
- Ultra-fast 4-6 step generation (vs 30+ for standard models)
- High-quality photorealistic output
- Baked VAE for optimal quality
- Professional portraits and scenes
- Both SFW and NSFW capable

**Use Case:** Rapid photorealistic NSFW generation when speed is priority

**Example Prompt:**
```
Beautiful woman portrait, professional photography, natural lighting, high quality, detailed, 8k
```

**Negative Prompt:**
```
(worst quality, low quality:1.4), bad anatomy, deformed, blurry, watermark, text, ugly, cartoon, anime
```

---

---

## Advanced Workflows

### 4. NSFW Ultimate SD Upscale
**File:** `nsfw-ultimate-upscale-production-v1.json`

**Model:** LUSTIFY v7.0 GGWP (`lustifySDXLNSFW_endgame.safetensors`)

**Upscale Settings:**
- Upscale Factor: 2x
- Upscale Model: RealESRGAN_x2.pth
- Denoise: 0.25 (preserves original composition)
- Sampler: DPM++ 2M SDE
- Scheduler: Exponential
- Steps: 20
- CFG Scale: 7.0
- Tile Size: 512x512

**Features:**
- Professional 2x upscaling for NSFW images
- Combines RealESRGAN with diffusion refinement
- Tiled processing for handling large images
- Optimized for detailed skin texture
- Low denoise preserves original composition
- Can swap checkpoint for different styles

**Use Case:** Upscale NSFW images from 1024x1024 to 2048x2048 with enhanced detail

**Enhancement Prompt:**
```
photorealistic, professional photography, high quality, detailed skin texture, natural lighting, 8k, masterpiece, best quality, sharp details
```

**Refinement Negative:**
```
(worst quality, low quality:1.4), blurry, pixelated, jpeg artifacts, bad anatomy, deformed, watermark, text
```

**Tips:**
- Use denoise 0.2-0.3 for subtle enhancement
- Match enhancement prompt to original generation prompt
- Swap checkpoint node for different model styles (Pony, RealVisXL)
- Processing time: ~90-150 seconds for 2x upscale

---

## Installation

These workflows use models downloaded via `artifact_civitai_download.sh`:

```bash
# Models are already downloaded to /workspace/models/civitai/
# and symlinked to /workspace/ComfyUI/models/checkpoints/

# Verify models are available:
ls -lh /workspace/ComfyUI/models/checkpoints/lustify*
ls -lh /workspace/ComfyUI/models/checkpoints/*pony*
ls -lh /workspace/ComfyUI/models/checkpoints/realvisx*
```

## Usage

### Via ComfyUI API:

```bash
# Load workflow
curl -X POST http://localhost:8188/api/prompt \
  -H "Content-Type: application/json" \
  -d @lustify-realistic-t2i-production-v1.json

# Modify prompt and generate
curl -X POST http://localhost:8188/api/prompt \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": {
      "2": {
        "inputs": {
          "text": "Your custom NSFW prompt here"
        }
      }
    }
  }'
```

### Via ComfyUI UI:

1. Open ComfyUI at `http://localhost:8188`
2. Click "Load" and select workflow file
3. Modify prompt in the "API Positive Prompt" node
4. Click "Queue Prompt" to generate

## Model Comparison

| Model | Type | Speed | Quality | Best For | Prompt Style |
|-------|------|-------|---------|----------|--------------|
| LUSTIFY v7 | Photoreal | Medium (30 steps) | Excellent | Women, realistic scenes | Natural language |
| Pony Diffusion v6 | Anime/Furry | Medium (35 steps) | Excellent | Anime, cartoon, furry | Danbooru tags |
| RealVisXL Lightning | Photoreal | Very Fast (4-6 steps) | Excellent | Quick realistic generations | Natural language |

## Tips

### For LUSTIFY:
- Use detailed prompts describing scene, lighting, quality
- Avoid abstract/artistic terms
- Include photography keywords: "professional photography", "8k", "detailed"
- CFG 4-7 range works best

### For Pony Diffusion:
- Danbooru tags work very well (recommended over natural language)
- Use tag format: `1girl, solo, breasts, smile, looking_at_viewer`
- Mix safe/questionable/explicit content naturally
- Can do anime, cartoon, and furry styles
- Supports wide range of artistic styles
- CFG 7-8.5 range works best

### For RealVisXL Lightning:
- Keep prompts concise for best results
- Use lower CFG (1-2) for Lightning models
- 4-6 steps is optimal balance
- Great for batch generation

## Advanced Usage

### Adding LoRAs:
Use the `../text-to-image/lora-fusion-t2i-production-v1.json` workflow for multi-LoRA stacking support.

**How to use with NSFW models:**
1. Load the LoRA fusion workflow
2. Change checkpoint (node 1) to your NSFW model (LUSTIFY, Pony, RealVisXL)
3. Stack up to 3 LoRAs with adjustable weights:
   - LoRA 1 (Primary): 0.7-1.0 strength
   - LoRA 2 (Secondary): 0.4-0.7 strength
   - LoRA 3 (Accent): 0.2-0.5 strength
4. Common use cases:
   - Detail enhancer + skin texture + lighting style
   - Character LoRA + pose enhancer + background style
   - Primary art style + secondary blend + color grading

### Upscaling:
Use `nsfw-ultimate-upscale-production-v1.json` for professional 2x upscaling with LUSTIFY checkpoint.

**Workflow:**
1. Generate image with any NSFW T2I workflow (LUSTIFY, Pony, RealVisXL)
2. Load the generated image into Ultimate SD Upscale workflow
3. Use denoise 0.2-0.3 for subtle enhancement
4. Match enhancement prompt to original generation prompt
5. Output: 2048x2048 high-quality upscaled image

### Style Transfer:
Use IP-Adapter workflows in `../image-to-image/` directory to combine with style references.

## Using Negative Embeddings

Negative embeddings (textual inversions) are small trained models that significantly improve image quality when used in negative prompts. They help avoid common artifacts like bad anatomy, unrealistic features, and low-quality outputs.

### Available Embeddings

**For SDXL Models (LUSTIFY, RealVisXL):**
- `BadX` - Fixes facial/hand artifacts, improves overall realism

**For Pony/WAI-Illustrious Models:**
- `zPDXL3` - Quality enhancement + removes censoring
- `zPDXLxxx` - Enables explicit NSFW content

**For SD 1.5 Models (future workflows):**
- `BadDream` + `UnrealisticDream` - Dreamshaper artifacts + realism
- `badhandv4` - Improves hand details
- `FastNegativeV2` - General quality enhancement
- `BadNegAnatomyV1-neg` - Better anatomy and body joints
- `easynegative` - General-purpose quality

### Installation

Embeddings are automatically downloaded and linked to `/workspace/ComfyUI/models/embeddings/` when you run:

```bash
cd /workspace/ai && bash /workspace/bin/artifact_civitai_download.sh both -c models_civitai.yaml
```

### Usage Syntax

**Basic usage in negative prompt:**
```
embedding:BadX
embedding:zPDXL3
```

**Multiple embeddings:**
```
embedding:zPDXL3, embedding:zPDXLxxx, score_4, score_5, low quality
```

**With weight adjustment:**
```
(embedding:zPDXL3:1.5), (embedding:BadX.pt:1.2), ugly, deformed
```

**Note:** When using weights, include the full filename with extension (.pt or .safetensors).

### Recommended Usage by Workflow

**LUSTIFY Realistic T2I:**
```
Negative: embedding:BadX, (worst quality, low quality:1.4), bad anatomy, deformed, blurry, watermark, text
```

**RealVisXL Lightning T2I:**
```
Negative: embedding:BadX, (worst quality, low quality:1.4), ugly, cartoon, anime
```

**Pony Anime / WAI-Illustrious T2I:**
```
Negative: embedding:zPDXL3, embedding:zPDXLxxx, score_4, score_5, score_6, bad anatomy, deformed
```

Or with custom strength:
```
Negative: (embedding:zPDXL3:1.5), (embedding:zPDXLxxx:1.2), score_4, score_5, low quality
```

**NSFW Ultimate SD Upscale:**
```
Negative: embedding:BadX, (worst quality, low quality:1.4), blurry, pixelated, jpeg artifacts
```

### Important Compatibility Notes

**CRITICAL:** SD 1.5 embeddings (BadDream, badhandv4, etc.) DO NOT work with SDXL models due to different CLIP architectures. Always use:
- **SDXL models** → `BadX` embedding
- **Pony models** → `zPDXL3` and `zPDXLxxx` embeddings
- **SD 1.5 models** → SD 1.5 embeddings only

Using the wrong embedding type will cause errors or unexpected results.

### Tips

- Start with recommended strength 1.0-2.0 for Pony embeddings
- `zPDXL3` removes censoring, ideal for NSFW Pony workflows
- Combine multiple embeddings for best results
- `BadX` works with all general SDXL checkpoints (LUSTIFY, RealVisXL, etc.)
- Higher CFG scales (≥11) work better with `badhandv4` (SD 1.5)

## Notes

- All workflows follow production naming standards
- VRAM requirement: ~12GB per SDXL model
- Can run one NSFW model at a time on 24GB GPU
- Models automatically use BakedVAE when available
- Face enhancement can be added via Impact-Pack nodes

## Version History

- v1.0 (2025-11-23): Initial release with complete NSFW workflow suite
  - **Text-to-Image Workflows:**
    - LUSTIFY realistic T2I (DPM++ 2M SDE, 30 steps, CFG 6.0)
    - Pony Diffusion anime/furry T2I (Euler A, 35 steps, CFG 7.5)
    - RealVisXL Lightning fast T2I (DPM++ SDE Karras, 6 steps, CFG 2.0)
  - **Enhancement Workflows:**
    - LoRA Fusion multi-stack (in ../text-to-image/, compatible with all NSFW checkpoints)
    - NSFW Ultimate SD Upscale (2x upscaling with LUSTIFY + RealESRGAN)
  - **Total:** 3 NSFW-specific workflows + 2 enhancement workflows = 5 production workflows
