Using Only 1 Channel for a Black-and-White Texture

Currently, to bake shadows and AO, I create a texture of appropriate dimensions in the UV/Image Editor, bake to that and save it. This makes for a whole 3-channel image file, which for a 2048x2048 black-and-white texture even without alpha ends up taking up a whopping 12MB on disk, and is probably a cause for my horrendous load times and frame rates lately.

Since all 3 (or 4) channels’ values are equal in a black-and-white image such as a shadow map, AO map or specular map, we only need to use 1. If your material doesn’t use transparency, it would make sense to save it in the unused alpha channel of your main texture. If it does use transparency, it would still save a lot of space to create a single-channel texture, or create an RGBA texture and have 4 different objects’ materials share the same texture, each using a different R, G, B or A channel.

The shaders of other products such as Unity indeed use the alpha channel of your diffuse texture for, say, a multiply-blended specular map, allowing you to get it all in one texture efficiently. If such products’ users saw us here wasting space with all the channels of a separate texture, they would probably laugh at us.

To avoid being laughed at, how can we:

  • Create a single-channel texture, or bake shadow/AO data to only 1 specific channel of a texture?
  • Specify only that channel when sampling that image?

When creating an image in the UV/Image Editor window, you can check or uncheck Alpha, but I don’t see an option for black-and-white (ie. “R” channel only).

Thanks.

You can always use gimp/photoshop to make your AO map to take only one channel of the image. Usually you should multiply your AO map with your diffuse texture anyways.

If I need to use separate AO map then I add it to the alpha channel of the normal map when I work with unity.

This feature you suggest would be nice to have but it would need the user to write custom shader to use this baked texture in game therefore I highly doubt such a feature will ever be implemented in blender. No idea if someone nowadays even cares to update blender internal renderer and it’s current features.

Unity’s way of using specular can save some texture memory but colored specular maps are a MUST when you want to really make great looking art.

Probably. Can you be more specific as to how (in GIMP) or link a tutorial on such? How would you then get Blender (specifically for the BGE) to use that one particular channel as a separate material slot?

Good idea, if your shadow map is to be the same dimensions as your texture (ie. a tiny texture is not tiled a hundred times across a wall, which would need one non-tiled, higher-resolution shadow map)

Point taken.

Sure, I can write short tutorial in hour or two.

Edit: Looks like there is no way to use such a node material in BGE (I wonder why, this should be really doable…) but it does work in blender render but that really does not help you.

Only way is to write custom shader for such a material and I am not experienced enough to do such a thing.

But here is how you can add AO to the alpha of diffuse.
https://vimeo.com/40484927 should be available in 30minutes.

Faster way is just to drag&drop that AO image to channels window but for some weird reason I could not do that when I was recording that video.

If you are using tiled textures, you still can put your AO to alpha of this tiled texture, just make sure your model gets AO from the alpha of this texture and make it use different UV coordinates