π CR SDXL Base Prompt Encoder
SDXL's dual-CLIP encoding, with the micro-conditioning exposed
- base_clip
- base_positive
- base_negative
- show_help
SDXL doesn't encode your prompt through one text encoder, it uses two - OpenCLIP ViT-bigG (usually called the "G" encoder) and CLIP ViT-L (the "L" encoder) - and it was trained with extra numeric conditioning about the image's original size and crop position on top of that. Comfy's own CLIPTextEncodeSDXL node handles this, and CR SDXL Base Prompt Encoder is Comfyroll's version of the same idea: one node, four text boxes, six numbers, two CONDITIONING outputs ready for your KSampler.
If you've only ever used a single CLIPTextEncode box and gotten fine results, you can absolutely keep doing that - most modern SDXL checkpoints tolerate a single merged prompt reasonably well. This node exists for people who want the extra control the dual-encoder setup was actually trained with.
How it works
You feed it your model's base_clip. Then four separate text fields: pos_g and neg_g go to the G encoder (traditionally the longer, more descriptive prompt), pos_l and neg_l go to the L encoder (traditionally shorter, more concept-tag-like - closer to how SD 1.5 prompts read). The six integer fields - base_width/base_height, crop_w/crop_h, target_width/target_height - feed SDXL's micro-conditioning: they tell the model what "original" resolution and crop the training image supposedly had and what resolution you're targeting now. In practice, people nudge these to reduce cropping artifacts (a larger claimed original size and zero crop tends to read as "less cropped-in" to the model) rather than to literally describe a real source image. The preset dropdown gives you a couple of quick-start combinations for those six numbers instead of hand-typing all of them every time.
The inputs and outputs that matter
base_clip- your model's CLIP, from the same checkpoint you're sampling with.pos_g/pos_landneg_g/neg_l- the four prompt fields. This is where your actual writing goes.preset- a shortcut for the six size/crop numbers below, instead of setting each by hand.base_width/base_height,crop_w/crop_h,target_width/target_height- SDXL's micro-conditioning integers. Leave these at sane defaults (matching your actual generation size, crop at 0,0) unless you're specifically experimenting with the cropping-artifact trick above.
Outputs are base_positive and base_negative (CONDITIONING) - wire these straight into your KSampler's positive/negative inputs - plus the standard show_help link.
How to install it
Comfyroll Studio (Suzie1 and RockOfFire) - pure Python, no models or heavy dependencies beyond what ComfyUI already needs to run SDXL.
- ComfyUI Manager - search "Comfyroll Studio," install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git, then restart.
Common issues & troubleshooting
This only handles the base pass. The name is exact - it's not a refiner encoder. If your workflow also runs an SDXL refiner stage (worth noting: the SDXL realism community mostly stopped bothering with the refiner once fine-tuned checkpoints matured - it's an optional second pass, not a required one), you need a separate encoder for that stage's text.
Confused by pos_g/pos_l needing different text than a normal prompt. You don't have to split anything cleverly - putting the same text in both G and L fields works and is what a lot of people do. The split only matters if you're deliberately experimenting with giving the two encoders different framing.
Odd cropping or composition after touching the micro-conditioning numbers. That's expected - those six integers are directly steering SDXL's trained notion of "what crop is this," so pushing them far from your actual output size will visibly change composition. If you're not trying to fix cropping artifacts specifically, leave target_width/target_height matched to your real generation resolution and crop_w/crop_h at 0.
Comfyroll nodes missing entirely. A pack-wide load failure shows as Comfyroll Studio: Failed to load Graphics nodes and a trailing NameError: name 'CR_HalftoneGrid' is not defined in your startup log - a symptom of an earlier import error, commonly a Pillow conflict from another custom node. Force-reinstall Pillow or reinstall the pack cleanly and restart.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| base_clip | CLIP | β | |
| pos_g | STRING | POS_G | β |
| pos_l | STRING | POS_L | β |
| neg_g | STRING | NEG_G | β |
| neg_l | STRING | NEG_L | β |
| preset | COMBO | 3 options: preset A, preset B, preset C | |
| base_width | INT | 40960β16384 | β |
| base_height | INT | 40960β16384 | β |
| crop_w | INT | 00β16384 | β |
| crop_h | INT | 00β16384 | β |
| target_width | INT | 40960β16384 | β |
| target_height | INT | 40960β16384 | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| base_positive | CONDITIONING | β |
| base_negative | CONDITIONING | β |
| show_help | STRING | β |