One of the most common parts of any pipeline is a texture packing process of some sort. This is usually the result of the complexities of a shader, requiring artists to adhere to a rigid packing spec to maximize performance and pack masks as efficiently as possible.
In any production of any scale, 3D art production will involve some amount of texture packing. There are many ways to perform texture packing, and not all of them require some kind of pipeline solution. However, once the packing spec reaches a certain level of complexity, a measure of control over the packing process becomes desirable.
In this article, we will build a simple texture packer (which works with .TGA files and most other common file formats), that could lay the foundation of building a more complex one on your own, without requiring any expensive software licenses to do so.
Building the base class
Implementing a simple Mask Packer
And that's all we need for a simple packer! To illustrate how you could expand this, and why the base class is useful to have around, let's create one final example, a slightly more complex packer designed to use of the numpy module, to take the input images and procedurally generate a combination of them as an output channel.
The example given here is rather simple, but of course you can feel free to make this as complex as you need, according to your needs.
And that about wraps it up for our simple texture packer using numpy and PIL! there isn't much to it, but you can see how with only a little additional code you could add things like config files, validation, and more complex generated channels that the artist wouldn't have to create themselves.
Comments
Post a Comment
All questions about blog or article content are welcome. Questions about my employment or employer, past or present, will not be answered.