ArtificialGuyBR

Home / Blog / Prompting and control

SDXL Prompt Structure for Realistic Photography

Structure SDXL prompts with dual-encoder conditioning, templates, artist tags, and ComfyUI presets for photorealistic results.

8 sources cited Prompting and control

TL;DR


Why Prompt Structure Matters in SDXL

SDXL uses two text encoders. The base model's cross-attention receives conditioning from both, producing separate pooled outputs. A refiner model adds a third conditioning path. How you distribute prompt text across these channels changes the image. (https://arxiv.org/abs/2307.01952)

The Comfyroll Custom Nodes expose this routing through the CR SDXL Prompt Mix Presets node, which maps your positive/negative prompts and optional style text into pos_g, pos_l, pos_r (and negative counterparts). Five presets handle common routing patterns. (https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py) (https://civitai.com/articles/1835)


The Three-Conditioning-Channel Model

ChannelTypical UseSource
pos_gGlobal style, aesthetic directionhttps://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py
pos_lSubject, composition, spatial detailhttps://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py
pos_rRefiner conditioning (if used)https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py

Each channel is tokenized and encoded independently. If token lengths differ, ComfyUI pads with empty tokens to match. (https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py)


CR SDXL Prompt Mix Presets — What Each Does

Presetpos_gpos_lpos_rBest For
Default (no style)promptpromptpromptBaseline, single-prompt workflows
Default (with style)prompt + styleprompt + styleprompt + styleSimple style blending
Style boost 1stylepromptstyleStrong style transfer; subject isolated in L
Style boost 2prompt + styleprompt + styleprompt + styleMaximum style saturation
Style text to refinerpromptpromptstyleRefiner-only style injectionhttps://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py

Practical tip: Start with Style boost 1. Put your photographic/technical language (camera, lens, lighting) in the prompt field; put aesthetic style tokens (artist names, medium, era) in the style field. The presets route style text to G and R while the subject stays in L — routing, not blending. (https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py)


Structured Prompt Templates That Work

Character Portraits: Persona → Clothing → Scene

This three-block template (community-reported from Civitai 11432) structures character prompts into clear categories: (https://civitai.com/articles/11432)

[Persona]: [Age], [Gender], [Facial features], [Hair & eyes], [Personality], [Pose]
[Clothing]: [Type], [Material], [Fit], [Color & pattern], [Accessories], [Footwear]
[Scene & Mood]: [Environment], [Lighting], [Photography style]

Example:

[Persona]: 28-year-old woman, wavy brown hair, hazel eyes, confident smile, standing with hand on hip
[Clothing]: Beige trench coat, cotton gabardine, tailored fit, black turtleneck underneath, skinny jeans, ankle boots, leather handbag, sunglasses
[Scene & Mood]: Cobblestone Paris street, golden hour, shallow depth of field f/1.8, 85mm lens

General Purpose: PixelWave 4-Part Template

The PixelWave SDXL fine-tune was captioned with ChatGPT using this structure — it's the model author's design for how prompts should be written. (https://civitai.com/articles/5005)(https://civitai.com/models/141592/pixelwave)

  1. Main Description — Primary subject, action, key features
  2. Artistic Style — Medium, genre, or named style (e.g., "watercolor", "oil on canvas", "digital art")
  3. Additional Details — Environment → Mood/Atmosphere → Color Palette
  4. Tags — Comma-separated keywords for residual concepts

Example:

A lighthouse on a rocky cliff at dawn, watercolor, misty ocean with gentle waves, peaceful morning atmosphere, soft pastels pink orange light blue, sunrise ocean peaceful rocks light

Artist and Style Tokens: Using the SDXL Art Style Explorer

The SDXL Art Style Explorer (Hugging Face Space by terrariyum) provides: (https://huggingface.co/spaces/terrariyum/SDXL-artists-browser)(https://civitai.com/articles/1730)

Workflow: Search a style (e.g., "cyberpunk") → filter artists → pick 2–3 with strong tag overlap → insert their names into your style field (for Style boost 1, that's the style_positive input). Avoid flagged artists unless you're testing.


Camera and Lighting Language: What the Community Uses

The following terms appear in community guides (Civitai 11432) and produce visible shifts in SDXL output. They are reported as community practice — no public ablation study confirms a causal link to photorealism. Treat them as style markers, not optical simulations. (https://civitai.com/articles/11432)

CategoryTokens from source 11432
Camera bodyCanon EOS 5D Mark IV, Sony A7 III
Lens85mm lens, 50mm f/1.8 lens
Depth of fieldshallow depth of field f/1.8, deep focus f/11, bokeh background
Lightinggolden hour, studio lighting softbox, overcast diffused light
Compositionclose-up portrait, over-the-shoulder shot, bird's-eye view

Negative prompt baseline (community folklore, no controlled test): cartoon, illustration, anime, painting, CGI, 3D render, unrealistic proportions, extra fingers, low quality (https://civitai.com/articles/11432)


Common Errors and Fixes

SymptomLikely CauseFix
Style tokens ignoredAll text in one channel (pos_g or pos_l only)Use CR Prompt Mix Presets → Style boost 1
Refiner adds unwanted styleStyle text not routed to pos_rUse Style text to refiner preset
Artist name gives generic resultArtist not in SDXL vocabularyCheck Art Style Explorer — flagged artists are marked
PixelWave output drifts from intentFreeform prompt instead of 4-part templateApply Main Description → Style → Environment/Mood/Color → Tags

Where Automated Tag Generators Help (and Where They Don't)

The SDXL Art Style Explorer is itself a tag discovery tool — it maps 200+ curated style tags to artists the model recognizes, and flags those it doesn't. (https://huggingface.co/spaces/terrariyum/SDXL-artists-browser) For tag generation from images or reference styles, community tools exist, but they share a limitation: they output flat strings with no awareness of SDXL's dual-channel structure.

Best practice: Generate tags from any source → split into subject (L channel) vs. style/aesthetic (G channel) → route via Prompt Mix Presets.


Minimal ComfyUI Workflow for Dual-Channel Prompting

  1. Load Checkpoint → SDXL base (and refiner if used)
  2. CR SDXL Prompt Mix Presets → connect prompt_positive, prompt_negative, style_positive, style_negative; select Style boost 1
  3. CR SDXL Base Prompt Encoder → feed pos_g, pos_l, neg_g, neg_l from step 2; set resolution/crop params
  4. KSampler → use encoded conditioning from step 3
  5. (Optional) Refiner → feed pos_r/neg_r from step 2 to refiner sampler

FAQ

How do I split prompts across SDXL's two text encoders? Use the CR SDXL Prompt Mix Presets node in ComfyUI. Set preset to Style boost 1. Put subject/technical language in the main prompt field; put aesthetic/style tokens in the style field. The node routes them to pos_l and pos_g respectively. (https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py)

What's the difference between pos_g, pos_l, and pos_r in ComfyUI? pos_g routes to the G encoder conditioning (global style). pos_l routes to the L encoder conditioning (spatial/subject detail). pos_r routes to the refiner model. Each is independently tokenized and encoded. (https://arxiv.org/abs/2307.01952)(https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py)

Which artist names does SDXL actually recognize? Open the SDXL Art Style Explorer (Hugging Face Space). Search or browse — artists SDXL doesn't know are explicitly flagged. Only use unflagged names in your style field. (https://huggingface.co/spaces/terrariyum/SDXL-artists-browser)

Does PixelWave need a special prompt format? Yes. The model was fine-tuned on ChatGPT-generated captions following a 4-part structure: Main Description, Artistic Style, Additional Details (Environment → Mood → Color), Tags. (https://civitai.com/articles/5005)

Why do camera model tokens improve realism in SDXL? Community observation: they act as style markers associated with photographic training data. No public research confirms a causal optical mechanism. (https://civitai.com/articles/11432)


Sources

  1. Podell et al., "SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesis," arXiv:2307.01952, 2023. (https://arxiv.org/abs/2307.01952)
  2. Comfyroll Custom Nodes source code, nodes_sdxl.py. (https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py)
  3. Civitai article 11432, "Ultimate Guide to Creating Realistic SDXL Prompts," xtremedamage, Feb 2025. (https://civitai.com/articles/11432)
  4. Civitai article 5005, "The PixelWave Prompt Template," humblemikey, Apr 2024. (https://civitai.com/articles/5005)
  5. Hugging Face Space: terrariyum/SDXL-artists-browser. (https://huggingface.co/spaces/terrariyum/SDXL-artists-browser)
  6. Civitai article 1835, "SDXL Prompt Mixer Presets," Akatsuzi, Aug 2023. (https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/nodes/nodes_sdxl.py)
  7. Civitai article 1730, "Discover styles and artists for your prompts! SDXL Artist style explorer," terrariyum, May 2024. (https://huggingface.co/spaces/terrariyum/SDXL-artists-browser)
  8. PixelWave model page, Civitai model 141592. (https://civitai.com/articles/5005)