santa hat
deerdeer nosedeer glow
Sign In

Hellrunner's Mask-Maps, Attention Masking

Hellrunner's Mask-Maps, Attention Masking

Put stuff exactly where you want it on your canvas, with as many prompts as you like. Let's get
into some game engine texture packing tricks.

here some examples:
Alice - Derelict Wonderland or The Rusty Returns ^^
An audience, and the Queen's toys
Guh and Phy in human form

okay, what are we doing?

This...

We take in an RGB mask-map and split it up into its channels. Red, Green, Blue.

(some programs and compression methods do not store color information if the pixel is alpha = 0 100% transparent, unless specifically specified)

we clip encode our 3 positive prompts and add the masks to the conditioning. Because of how the mask-maps are structured there is no need to play with the weights here (in fact that could mess things up, royally). You can weight the prompts themselves for maximum controllability and ease of use. (more on mask-maps later)

we combine the conditionings and encode the unified negative. (You COULD, ofc do the same pipe for separate negatives)

This is where the magic happens. We're looking at the most basic setup for this. You could at any point mix in ControlNets and even LoRAs. (if you mask the model output too somehow and combine them as well)

The combined positive and the neg we shall apply.
To the model or from,
With some space magic, we done.
APPLY i say!

i have zero clue what that actually does ^^ haven't looked into it. With it influencing "Attention" you get multi-concepts seamlessly woven together in a single gen. With it set to "Latent" it makes separate noises for the masks. That can be totally amazing if you have stuff happening on a TV screen or a wide scale shot of a theater play (with a floating prompt - nothing in common with the others - showing a totally different scene), but it can also overload the transition areas on smooth gradients (resulting in a bad photoshop look).

And OFF you go ^^ ctrl+enter ... queue prompt

so, how do i make these mask-maps?

There are many ways of doing it. You could do it in MS paint with the downside of being binary again ^^. The best way to create the mask-maps, in context of its compatibility and extendibility, is in Krita. You gonna need it later anyways :D

New document in native XL rez. Set the color specifically to 100% bule and ONLY blue.

...and bucket the canvas.

Then you can AGAIN specifically set red, and paint on a new layer. The same with green. The layer blend mode needs to be set to "normal".

and that's that ^^

yeah, but why are we doing it like that?

Now the interesting part ^^
Remember when i said "game engine texture packing tricks" ... that was fun. good times. :D
Sry ^^ In game engines you pack single-channel maps (black and white), with totally different uses together into a single RGB image to save texture sampler lookups. (why do it 3 times, if you can do it once?!) Roughness, metallic and baked ambient occlusion (for example), each occupying a channel. After the texture sample in the material you split up the map into it's channels and feed them to the appropriate shader slots. If the roughness channel would somehow bleed into the metallic it would mess up the rendered look of the material ROYALLY. (like feeding a depth-map to openpose)

If you use just kinda the right colors, the prompts will bleed into each other.

Also the overall prompt weighting on the canvas gets inconsistent.

(all layers added up at 50% strength, 50% grey = 100% combined prompt weight, white = 200%)

If you DO use the full colors but set the layer to additive the same effects happen on steroids.

Blue alone is at 100% prompt weight.

If you use exact colors and mix them normally you override the value of one channel with the one of the other, resulting in clan channel separation.

When added together, all pixels equal to 1, resulting i homogeneous prompt weight distribution.

And that's why you don't mess with the "Conditioning (set Mask)" strength. ^^

OR since you now know how to effectively use mask-maps you mess with it deliberately and find out new things :D

For Alice - Derelict Wonderland or The Rusty Returns ^^ i used 2 mask maps at the same time... subtracting the red and green from the blue of the other and clamping. That way i have 4 subject and one background prompt. Combined with the detailers it equaled to 8 prompts on the same image. The background, Alice, the Jabberwock's body, it's head, the waterfall and various detailer descriptions.

hope you enjoyed it ^^

- Hellrunner <3

PS: follow me for more

10

Comments