Units:Textures

Contents

Textures for S3O

S3O, as the most modern file format for models in the Spring engine, has some tricky bits. One of them is learning to use the right texture formats to achieve your goals. Luckily for would-be content developers, Spring is very forgiving about image file-types, and allows users to make use of the TGA, PNG, BMP and DDS image file formats.

S3Os that are being rendered with Spring's ARB shaders (i.e., the default rendering pipeline) have two textures, each of which is supposed to be RGBA, not just RGB- i.e., 32-bit, not 24-bit. The alpha channel, which something many new modelers / painters aren't familiar with, has specific uses. If you don't know what an alpha channel is, please Google it and read a bit before continuing with this lesson.

Texture1

This texture is used to store the color values of the model (i.e., what people usually call the "skin") and the team-color values are stored in the alpha channel, as a grayscale, where white is pure team-color, black is none at all, and all gray values are in between. This is blended with the color values, reflective and glow values to arrive at a final color in the engine. Until you have more experience with graphics programming, it's enough to know that if you don't put any colors into your alpha channel, the model won't have team-color, and if you fill it with white, you will not see your colors at all.

Texture2

This is the "secondary" texture, but it is probably the most important, in terms of your final quality.

This texture uses RGBA, just like Texture1, but it uses each color channel indepedently, due to the way the ARB shader works. If you haven't learned to view the Channels in your images yet, this is where you should start learning, right now. To get the most out of this area of Spring (or for that matter, practically any game engine these days) it's important to understand how to work with image channels for precise control over the color values of any given pixel.

Green values are reflectivity. The more green in a given pixel, the more reflective it will be.

Red values are glow. The more red in a given pixel, the more glow it will have, overriding the light levels in a scene. A white Texture1 pixel with a totally red Texture2 pixel will always be completely white, no matter what.

Blue values do not have a use, in the standard ARB shader. There are variants of the ARB shader available, where the blue value does various things. These derivative versions of Spring's ARB shader code are Open Source, so please ask around if you want to know more about these, people will be happy to share them with you.

The alpha channel is one bit, if you're using Spring's default ARB shader. Black pixels == "clear", and will not be rendered at all. White pixels are "solid". This can be used to create "holes" in your models, etc.

Texture Formats For S3O

Spring supports TGA, PNG, and DDS.

TGA and PNG have no performance advantages, are rendered upside-down in UpSpring (which makes it hard to see if the final model is correct, without running the engine), and take up full texture RAM on the GPU. Neither format is recommended, but they are easier for newbies to use.

DDS is the preferred image format, and is what UpSpring was designed to use.

General Guidelines For DDS Textures

  • It is recommended to use DXT5 or DXT3 compression for Texture 1, and DXT1 with alpha channel for Texture2
  • Turn on mipmaps. You MUST make all of the mipmaps. Not one, not two, not four... all of them. This means when making a DDS, it may take a few moments to compress, especially if it's large. This is normal, do not be alarmed.
  • If your texture is invisible ingame or is just plain black/white, make sure you have turned on Mipmaps, set a radius and height for your model in UpSpring, and not have pure black or white backgrounds (255,255,255)/(0,0,0), set them to anything other than those.
  • DDS requires specific settings, in order to reduce compression artifacts and sharpen the mipmaps so that the resulting images look their best in Spring. This gives you much more control over quality than PNG or TGA, where the end-user's hardware determines what the mipmaps look like (which frequently will look a lot worse than DDS), but it requires some study.

However, if you have Photoshop, you can just get the nVidia DDS Plugin from here, and use Argh's DDS compression settings, which work well with DXT1, DXT3 and DXT5 (but are not yet optimized for DXT5 normalmaps). Download that here.


Textures- 3DO (i.e., OTA game ports)

Textures are stored in the UnitTextures directory of your game. They may be Windows .BMP format at 24 bit color depth, or a Targa .TGA file in 32 bit (alpha layer) color depth.

Rules for textures

OTA mods using 3DO models store their textures in a Texture Atlas. This is a single 2048 / 2048 image that is built by Spring automatically from the small images used as tiles in OTA. Thus, the total size of all of your 3DO textures cannot exceed 2048 / 2048. This is rarely a problem, if you're just porting an OTA mod.

Logo Textures / Team Color

In the case of logo textures, you must edit the file teamtex.txt in the UnitTextures/tatex directory (or in your game / mod, as it will overwrite Spring's values).

Just add the name of your texture to the list, without the "00". For example, if you wanted to add ArmLogo00.bmp to the team color list, you would put ArmLogo in the teamtex.txt file. The image must have only values in the Red, Blue and Alpha channels, to function correctly as teamcolor- the Green channel should be left black. So the resulting image will look "purple". If you are not experienced working with color channels, ask somebody for help, or read some tutorials.

Reflections

To make a texture reflect its environment, you must create a Targa file with an alpha layer with a program such as the GIMP or Photoshop.

The procedure is the same as making team-color textures, but with two twists:

1. Don't name the file in the teamtex.txt file.

2. You can use all four channels- RGBA, for full colors and alpha- and the alpha layer's white / black values determine how reflective the object is. If white, that area is totally reflective. If black, it will not reflect the world at all. It should be noted that some image editors have trouble setting alpha layers to 100% and cause Spring to display the image as completely black, hence it is suggested you make it about 99%.

Conversion from .GAF

In Total Annihilation textures were stored in /Textures/*.gaf. If you're porting an old TA mods, there will be hundreds of textures to convert to Spring format. There is an easy way to automatically extract all the texture from all the .gaf into well named .bmp: Download GAF Dump. Then run GAFDump.exe, from inside the folder your textures are, and with the -b commandline option.

To save yourself some more trouble, we strongly suggest that you use 3DOBleacher to remove all of the "shading" versions of the textures from the mod you're porting, as well. This will save a huge amount of space on the Texture Atlas and the final results will look a lot more professional in Spring. 3DOBleacher requires some reading and a lot of work to set up, however.

Retrieved from "http://springrts.com/wiki/Units:Textures"

This page has been accessed 2,385 times. This page was last modified 19:00, 21 August 2009.


 
 

Page editing toolbox

Browse
Main Page
Community portal
Current events
Recent changes
Random page
Help
Donations
Edit
View source
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Log in
Special pages
New pages
File list
Statistics
Bug reports
More...

Site layout created by Roflcopter.