logoHome of High Quality Low Poly Models

Tutorial #1

All about Texturing

Texture Size: Aspect ratio

I have seen too many problems with textures in the last year, so I am going to address a few points here for newbees and others.

First, the video card determines what size it uses internally and the
formats are all square, like 256x256,512x515 up op like 2048x2048 or
higher even for the newer video cards. Each time a dimension is doubled, remember that the file size will be 4 times bigger when they same compression factor is used. So keep the files SQUARE in size, all other ratios will have to be converted to multiples of 64, 128, 256, 512 and so on. except for animated textures, the browser treats those differently. That does not mean you cannot use any other sizes, it just means extra processing required to display the image. I have used textures that are exactly twice as wide as high to get better sharpness. Here is an example.

sign

A file that is a multiple of the height is treated as a film strip in AW, so the above recommendations don't apply.

Texture size needed:

I see most of the problems with free models from the internet, and those textures were designed without regard to final use here. So folks, I suggest you change them based on what I am outlining here for a better download experience. But in case you want to go back to the original, always keep a copy. You cannot retrieve the information lost by making them smaller or by compressing them too much.

Secondly, the basic data length on the internet is something like 1048 bytes, as determined by the MTU setting. Anything smaller will be padded with empty information. That means that there is no reason to make textures size smaller than that. But from what I have seen, most textures are way bigger in file size simply because people don't pay attention. A lot of modelers don't pay attention because either they use an exiting texture or they don't think about what size is really needed.

It really is quite simple. The texture size should correspond to the physical or virtual size of the model. Say a hoof of any animal does not need a 512x512 texture, simply because it is such a small part of the whole model, that I think a 64x64 or even smaller will do. A good rule of thumb is when the texture is not repeated, for AW a 256x256 over a 4 m square panel is sufficient, unless there is a lot of detail in it, and you want it to be sharper. Anything smaller can use a smaller size, something bigger will benefit either from tiling the texture repeatedly or if that's not possible, a higher resolution texture could be used.

File size:

One of the reason I am writing this, is that the total file sizes for the textures of a model can easily exceed the zipped file size of the model.
If you have been in worlds where you see the models pop up and then have to wait forever to see the textures, then you know that probably the texture sizes are too big. Also if you look at your OP you will find that the bulk of the space is taken up by textures, and if you are close to the limit, it is worthwhile to rescale some of the ones that you have, regardless of source and recompress them. Have a look at those files over 100k, there is no need to have any unless you plan to cover your whole world with one texture. Most should be in the 5 to 20k range, 512x512 sizes should compress to around 60k or less.

Compression factor:

Compression ratios are a very big factor in reducing textures file sizes. I use Photoshop and it has a compression function specific to the web. I use a compression ration of 60%, (in PSP the prefferred quality factor seems to be 30%) and I can take almost all texture files that I encounter from others and make the files way smaller without losing sharpness or creating nasty artifacts. I suggest you experiment with your own program and after saving load the texture back into your program and compare the result side by side to see if you are satisfied with the results. A side note, just about every texture from AW is perfectltly compressed, someone really knew what they were doing.

8 primary

Using normal jpg quality compression, the best size you can get at quality level 2 is 27.5k !

80- 60

60% - 3.06 kb

Compression ratios are a very big factor in reducing textures file sizes. I use Photoshop and it has a compression function specific to the web. I use a compression ration of 60%, (in PSP the preferred quality factor seems to be 30%) and I can take almost all texture files that I encounter from others and make the files way smaller without losing sharpness or creating nasty artifacts. I suggest you experiment with your own program and after saving load the texture back into your program and compare the result side by side to see if you are satisfied with the results. This is important to know when making picture signs with lots of text.

On the left I have 3 samples of a texture compressed with 3 different compression ratios using the Save for Web function in Photoshop. As you can see when you look at them closely ( you may have to copy them to your paint program and zoom in), the digital noise around the numbers gets worse with the smaller file size, but PS even at 20% and a file size of 2 k is still better looking than the standard jpg compression with a 27.5k files size. Looks like that the folks at Adobe really know what they are doing.

8- 4040% - 2.35 kb

80-20

20% - 2.00 kb

Sprites: Masks

All sprites use masks. The mask is a black and white looking image that are in bmp format and are zipped to make them smaller. The file format can actually be 3 different types, 24bit rgb, 8 or 4 bit grayscale or 1 bit b&w. The first creates huge file sizes and should not be used, tell me if you found a reason as to why you are using that format. I see that on many of the sprites that I come across. The b&w format makes extremely small file sizes and is used by all AW sprites. But is causes jaggies. If your sprite has a lot of angled lines, I recommend grayscale, 4 bit format, it really smoothes it out, but I have not experimented enough with the difference between the 4 and 8 bit, which doubles the file size. The 8 bit format is useful for making some semi-transparent areas, instead of using black to mask the cutout, if it is set to grey or somwhere in between, you will have some areas that are somewhat transparent, dependign on the amount of grey in the mask. Also make sure the mask matches the resulution of the texture file, as the browser will resize the larger one to the smaller.

PNG textures:

Png textures are most useful for masked textures. They are not as efficient in compression as jpg files, as the png compression is lossless. This means that the filesize will always be larger when compared to a jpg file.

To make a masked png file in Photoshop or Paint Shop Pro, create a transparent layer first. The texture will be the second layer, erase all the section that you want to be masked off. You can save the file as an 8 bit or 24 bit file, depending on how big a file you want. The 8 bit file will show some jagged edges compared to the 24 bit, and it will depend on the size of the object as to which you will prefer. What is not possible to do with this format are semi transparent areas. If you combine this with an opacity setting in the model, all areas are effected, unlike a masked files where you can use the mask (if it is an 8 bit ggreysacle mask) to set portions of it semitransparent.

Special cases:

Another little know fact is that the same primary texture can be used as a mask, this will lead to a transparent image, the transparency depends on the amount of brightness in the image. This is best experimented with, the only reason I mention it, is that only one texture needs to be downloaded. The code will look like this: create texture "texturename" mask="texturename'. This will not work if the 2 diferent texture names are used.