Introducing
Draconus Texture Utils (DTU)
DTU in Asset Store | DTU Documentation
DTU Trailer (Youtube)
What is DTU?
DTU is a versatile collection of texture processing utilities for Unity. It’s meant for building your own texture processing scripts and texture asset pipeline.
DTU comes with a simple, clean and ever-growing API to manipulate textures. DTU has four components: TextureUtils for the basic texture processing, AtlasGenerator for generating atlases and sprite sheets, file format readers (PSD reader with more readers coming in the future) and examples for showcasing the features of DTU.
DTU comes with a full C# source - no DLL’s needed!
Who is DTU for?
Primary audience is programmers and technical artists who want to build or optimize art workflows. While many of the examples in DTU are fully usable in other projects as-is (such as the atlas generation system), the main idea of DTU is to give you tools to implement just the workflow you need for your project.
Examples
DTU comes with various examples to get you started. These examples can be used as-is or as a basis for your own creations. Not only they show how to use different aspects of DTU, but also how to build usable Unity Editor interfaces around them!
Currently the list of examples includes (Some of the examples are shown in the introduction video)
Example 01: Atlas Generator
See how to slice tile textures and arbitrary sprite textures and pack everything into an atlas
Example 02: Bitmap Font
Generate your own font based on a hand-drawn bitmap font and update it directly to NGUI (optional)
Example 03: PSDReader
Read PSD files natively in Unity. Layers, masks and slices are supported.
Example 04: PSD Layer Extract
Generate complex textures from single PSD file, including normal maps and multi-channel textures (diffuse + gloss)
Example 05: Multilayer NGUI Atlas
Create a multilayered NGUI atlas with gloss and normalmap
Example 06: 2D Toolkit Atlases
Directly generate and update 2D Toolkit atlases (both normal and runtime atlases are supported!)
Example 07: PSD Spritesheets
From a single PSD file, slice multiple layers using PSD slices and pack them into a sprite sheet.
Example 08: Normalmapped Sprites
Create custom atlas format (ScriptableObject) and load it into custom normalmapped sprite system
Texture Utils
This is the heart of DTU. Create, slice, blend, modify and mix textures in various ways. For full API, check out the documentation at http://tools.draconus.com/dtu
Some highlights:
Generate normalmaps from top/left lit textures or heightmaps - and combine them.
var normalMapFromLitMaps = TextureUtils.GenerateNormalMapFromLitMaps(textureNormalLeft, textureNormalTop);
var normalMapFromHeightmap = TextureUtils.GenerateNormalMapFromHeightMap(heightmap);
var normalMapFinal = TextureUtils.CombineNormalMaps(baseTexture, normalMapFromHeightmap, 1.0f);
Create smooth outlines
var textureWithOutline = TextureUtils.CreateOutline(texture, Color.black, 4, true);
Modify texture channels freely
// change the colors of a texture to a gradient, red to blue (bottom-up pixel space!)
Texture2D gradientTexture = TextureUtils.ModifyColor(texture, (c, i, x, y) =>
{
float t = y / (float)i.height;
Color l = Color.Lerp(Color.red, Color.blue, t);
l.a = c.a;
return l;
});
// replace color of a texture with a color from another texture
Texture2D replacedColorTexture = TextureUtils.ModifyColor(texture, (c, i, x, y) =>
{
float u = x/(float)i.width;
float v = y/(float)i.height;
Color diffuse = anotherTexture.GetPixelBilinear(u, v);
diffuse.a = c.a;
return diffuse;
});
Atlas Generator
Yet another atlas generator
However, our atlas generator supports generating multilayered atlases, spritesheets and bitmap fonts. It can export various formats such as TexturePacker definition, BMFonts and 2D Toolkit runtime atlases (based on custom TexturePacker format). There are examples that show you how to directly integrate this with NGUI or 2D Toolkit.
PSDReader
PSDReader is a reader for Adobe Photoshop PSD file format. It currently supports layers, masks and slices. Layers can then be sliced and processed using TextureUtils functions.
PSDReader is written in portable C#, and it even works in runtime and for any PSD files - also files outside the asset database, much the same way the Texture.LoadImage works.
Got Interested?
Check out our documentation at http://tools.draconus.com/dtu and the introduction video. The introduction video showcases some of the examples included.