Optimising Textures using Gimp

Optimising Textures using Gimp

One way to reduce the memory usage in your level is to through judicious use of textures. The method I will discuss involves compiling a ‘composed‘ texture or ‘merge map’ by inserting three textures into one, so potentially saving upward of 60% in texture RAM.

This method is not applicable to all textures.

Traditionally a texture is composed of 24 bits which represent three 8 bit colour channels – Red, Green and Blue. These can then represent any colour. However in some images this extra data is wasted, this is where this technique comes in. So for black and white (Mask), grey scale images or textures with a simple colour pallet is used this will apply. I will try to demonstrate by example. I have some snow flakes textures that I would like use in a particle effect. These images fit because I can easily touch them up with a light application of blue in the material editor.

Figure 1

To do this I first need the 3 textures open in Gimp.

Then its just a matter of Decomposing colours to layers. First go to

Colors > Components and select Decompose…

Figure 2

Find the Decompose option in GIMP

The dialog will ask, how you would like to do this: RGBA, HSV, HSL, CMYK etc. In this example the default RGB will work fine.

Figure 3

Repeat this step for the other two textures.

When complete go to

Color > Components and select Compose…

Figure 4

Figure 5 shows the dialog to convert your layers to channels.

As each decomposed texture is open in Gimp their RGB colour channels will be exposed (Figure 5). So it will just be a matter of assigning each individual texture layer to each channel.

R: SnowCrystal_1

G: SnowCrystal_2

B: SnowCrystal_3

Figure 5

Click Ok.

The result will look a little odd perhaps even psychedelic but is very practical.

Figure 6

The benefit of this procedure is one can save considerable texture RAM see figure 7.

Figure 7

As the above table shows a single 1024px texture uses 683KB, so if you need 3 of these textures your total memory usage is (683 x 3) 2049 KB. However by compiling a composite texture you save 1366KB of RAM or 67%

This technique is also applicable to situations where several RGBA textures are in use, such as plant textures that use the alpha channel as a mask. Figure 7 shows the Unreal Engine does not compress Alpha channels nearly as much as RGB. So much that an Alpha channel represents a full RGB texture. So in the spirit of optimisation one could create a separate texture with all three Alpha channels compiled to RGB. The saving would be 67% – well worth the effort. Your audience will experience better performance or you will be able to ‘fill in’ that extra space with more polish to your levels.

The main caveat for this procedure is that the individual RGB channels are compresses aggressively so depending on its use, pixellation maybe visible, so use wisely.

This procedure is not limited to simply decomposing a full 24bit image to three 8 bit images. In cases where too much distortion /compression artifacts occur one could keep two channels for one texture then use a component mask say R and G to make use of those combined channels. There by still achieving a 33% gain in texture RAM and offsetting any compression problems.


Posted on October 17, 2011, in Tutorials. Bookmark the permalink. Leave a comment.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: