cover
Photo by Lucas Cao

Mastering SDXL Prompt: A Step-by-Step Guide

sd-advanced2023-08-301011.2 min

Introduction

let's forget about all the fancy stuff (masterpiece, best quality) and focus on the basics. start from zero and learn

Why SDXL

Why use SDXL instead of SD1.5? Because it is more powerful.

  1. Enhanced comprehension
  • Use shorter prompts
  • The SDXL parameter is 2.6 billion, while SD1.5 is 860 million.
  • Dual CLIP Encoders provide more control.
  1. Generate a greater variety of artistic styles.
  2. Improved aesthetic RLHF and human anatomy.
  • Bad hand still occurs but much less frequently.
  1. Ensure legible text. (However, not necessarily that good)
  2. Enhanced image composition.

So, basically, you gotta give a smarter stable diffusion a try. 😉

Before Prompting

To make things easier, there's one extension that we recommend you install before moving forward.

https://github.com/Physton/sd-webui-prompt-all-in-one?ref=simpleaiart.com

sd-webui-prompt-all-in-one

This is an extension based on sd-webui, aimed at improving the user experience of the prompt/negative prompt input box. It has a more intuitive and powerful input interface function, and provides automatic translation, history record, and bookmarking functions.

You don’t need to remember facial expressions, actions, clothes, environment, scene, or camera.Just search and click

sd-webui-prompt-all-in-one

If more content is needed, please refer to my another article.

sd-webui-prompt-all-in-one

Prompt Step by Step

First of all, let’s set the parameters as follows:

Steps: 50
Sampler: Euler a
CFG scale: 7
Size: 1024x1024
Model: sd_xl_base_1.0_0.9vae

Assuming that you are an artist who is drawing, with a blank sheet of paper in front of you.

The first thing to consider is what topic you want to draw, then choose a style that matches your vision. Afterward, decide on the composition, subject, and details you want to include in the artwork.

Prompting is as straightforward as that.

Step 1: Choose a Style

SDXL introduce aboutthousands of stylesfor you images,

https://stable-diffusion-art.com/sdxl-styles/?ref=simpleaiart.com

Lazy people can just download the extension directly.

https://github.com/Douleb/SDXL-750-Styles-GPT4-?ref=simpleaiart.com

Once you have downloaded thestyles.csvfile and placed it in the root path of the webui, kindly restart the webui for the changes to take effect.

Step 2: "General to specific" Prompt Strategy

When describing a drawing, an effective strategy is to go from "general to specific"

Start with the overall setting and gradually focus on the specific details. This helps the reader form a broad understanding of the scene before moving into the finer points. Here's an example:

  • Overall Scene: Describe the entire environment or backdrop, including time, place, and main objects or characters. For instance, "On a serene summer evening, the sun slowly descends, casting a golden glow over an expansive wheat field.
  • Key Elements: Describe the main elements in the scene. This could be an object, a group of objects, or a character. For example, "In the middle of the field stands a lone tree, its silhouette striking against the sunset's lingering light."
  • Details: Describe the specific details of these main elements, which might include their color, texture, shape, etc. For example, "The branches of the tree glisten in the golden sunlight, each leaf edged as if by a gilded frame."
  • Sensations and Emotions: Describe the feelings and emotions the scene evokes. This could be the observer's feelings or the atmosphere of the scene itself. For example, "The entire scene evokes a sense of tranquility and peace, as if time has paused in this very moment."

For Example

  1. General: "in spring,street,a girl"
  2. More Specific: "in spring,street,a young girl"
  3. Adding Detail: "in spring,street,a young girl with earrings"
  4. More Detail: "in spring,street,a young girl with pearl earrings"
  5. Even More Detail: "in spring,street,a young girl with large, lustrous pearl earrings"
  6. Specific and Detailed: "in spring,street,a young girl with large, lustrous pearl earrings, her eyes sparkling with the same shine as the pearls."

in spring,street,a young girl with large, lustrous pearl earrings, her eyes sparkling with the same shine as the pearls.

Fine-tune Prompts

You may wish to fine-tune your prompts, such as by downplaying certain characteristics and placing greater emphasis on other features.

You can add specific details to your prompt, such as stating that your character is a 21-year-old Asian girl.

You can also use weight syntax

  • (PromptA:weight)# "The 'weight' parameter in PromptA ranges from 0 to 2. For instance, a weight of 0.9 implies a reduction in emphasis, while a - weight of 1.1 signifies increased emphasis."
  • (PromptB)= (PromptB:1.1)
  • {PromptC}= (PromptC:1.05)
  • [PromptD]= (PromptD:0.952)
  • ((PromptE)= (PromptE:1.1*1.1)
  • {{PromptF}}= (PromptF:1.05*1.05)
  • [[PromptG]]= (PromptG:0.952*0.952)

downplay/emphasis prompt can be put in positive and negative prompt.

Setting 'big breast' to negative in the prompt signifies the absence of large breasts, but not the absence of breasts altogether.

Hidden Tricks

  • If you provide a prompt about shoes, it will highly likely generate a full-body image.
  • If you include too many details about the environment in your prompt, the output will be heavily biased towards a landscape.
  • If you mention the environment before the character in your prompt, the environment will likely be emphasized in the generated image.
  • prompts support emoji

Some tricks may not be that useful.

SD WebUI support these syntax but rarely used

  • "+":(red hair:1.1)+(yellow hair:1.25)+(green hair:1.4)
  • "and":(red hair:1.1) AND (yellow hair:1.25) AND (green hair:1.4)
  • ",":(red hair:1.1),(yellow hair:1.25),(green hair:1.4)
  • "":(red hair:1.1)(yellow hair:1.25)_(green hair:1.4)
  • "|":(red hair:1.1)|(yellow hair:1.25)|(green hair:1.4)
  • "":(red hair:1.1)(yellow hair:1.25)(green hair:1.4)

Prompts From file or textbox

you can use "Prompts From file or textbox" to generate a bunch of images to find best prompts in some scenario

Example Input

--prompt "photo of sunset"
--prompt "photo of sunset" --negative_prompt "orange, pink, red, sea, water, lake" --width 1024 --height 768 --sampler_name "DPM++ 2M Karras" --steps 10 --batch_size 2 --cfg_scale 3 --seed 9
--prompt "photo of winter mountains" --steps 7 --sampler_name "DDIM"
--prompt "photo of winter mountains" --width 1024

Following parameters are supported:

"sd_model", "outpath_samples", "outpath_grids", "prompt_for_display", "prompt", "negative_prompt", "styles", "seed", "subseed_strength", "subseed", "seed_resize_from_h", "seed_resize_from_w", "sampler_index", "sampler_name", "batch_size", "n_iter", "steps", "cfg_scale", "width", "height", "restore_faces", "tiling", "do_not_save_samples", "do_not_save_grid"

Prompts Matrix

You can also make minor adjustments to your prompts to test their effectiveness

For example, I use Prompts Matrix to test whether the 'Load LoRA' can affect the entire picture. You can when a load LoRA, the picture become gray background

Conclusion

Explore the power of SDXL in AI art creation with our guide. Enhance your skills in generating unique artwork using prompts, fine-tune them to reflect your vision, and discover hidden tricks and useful syntax options. Whether you're a beginner or an experienced user, get practical tips for your AI art journey. Happy creating!

Leave a Comment