Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glossary

This is an advanced topic, so first, a basic glossary for the semantics of this README:

  • Map: image comprised of several independant color channels: (R, G, B, A) where each color channel can independantly store a value from 0 to 1 (images typically go from 0 to 255, we treat 255 as 1.)
  • Mask: a set of values from 0 to 1. A map will be comprised of up to 4 of these, 1 for each channel.
  • Packing: the process of filling a map with masks to better optimise a map for storage/memory/processing load usage.
  • Mutually Exclusive: two attributes that will never both be present, only one at a time or neither.

Mutually Exclusive Packer for Paint.NET

Plugin for Paint.NET that will pack two maps filled with color component-wise masks into a single map. This pack is mutually exclusive: each color channel can be one of the two masks or nothing, but not both at the same time. Additionally, the middle value can be adjust to allocate more bit precision to one input over the other.

GPU Image plugin created with CodeLab.

For any given pixel...

Both the subtractive (negative) input layer and additive (positive) input layer should contain maps with masks formatted so that 0 is fully inactive and 1 is fully active.

  • When the masks of both maps from the input layers are fully inactive, the resulting value will be the middle value set in the plugin.
  • When only the subtractive map from the input layer is fully active, the resulting value will be 0.
  • When only the additive map from the input layer is 1, the resulting value will be 1.
  • If both maps are fully active, the mutually exclusive map is technically in an invalid state. The resulting value will be the result of the two maps cancelling each other out.

Why pick mutually exclusive packing?

Benefits:

  • Halves texture usage

Drawbacks:

  • Halves total bit depth among the maps
  • For each mask in one map, it needs to be paired with a mask that will never contain a value above 0 that overlaps with it.

Some example use cases:

  • Creating textures with an 8-color color palette to be coloured dynamically via code later with smooth edge transitions (assuming that 4 pairs of colors will never overlap)
  • Material detail maps that have attributes that will never overlap (e.g. RGB negative is occlusion, RGB positive is emissive. This specific example only makes sense depending on your pipeline.)

Normal maps are also technically mutually exclusive packed maps, where the negative map's RGB is Left/Down/Away from Viewer and positive map's RGB is Right/Up/Towards Viewer.

Building

Building is extremely simple. Install CodeLab for Paint.NET, clone the repository, open the MutuallyExclusivePacker.cs file in CodeLab and press build. All the parameters will be configured correctly for you already, so just press build.

Copyright ©2026 Jaime Shirazi Games.

All rights reserved.

About

Packs two layers into a half-precision packed layer where the channel is either none, layer 1 or layer 2, and never both simultaneously.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages