Help:Importing textures

From Killing Floor Wiki
(Redirected from Importing Textures)
Jump to: navigation, search

Import from Graphics File[edit]

First, make sure the image you are trying to import is:

  • A power-of-two number of pixels across (e.g. 1x1, 16x4, 64x128, 256x256, ...) up to 1024x1024.
  • Using 8-bit color (256 color indexed) BMP or PCX for UT; 8-bit indexed BMP or PCX, 24 bit or 32 bit TGA or DDS for UT2003.
  • Saved in .pcx or .bmp for UT; saved in .pcx, .bmp, targa, DXT or UPaint for UT2003.

Then, in the Texture Browser, do Texture Browser Menu -> File -> Import. Find the directory containg your .pcx or .bmp file, then select it and click Open. A window will appear asking for specifics on how to import the file:

Package

If you want to save the image in an external package, just enter the package name. If it does not exist, KFed will make a new package for it. It is a really really bad idea to import into a package file you downloaded or that came with the game: Do Not Alter Default Packages. If you want to use a few textures from a downloaded pack just export them and re-import them into your own package, and remember to credit the author. To embed textures into a map, use "MyLevel" as the package name and don't save it.

Group

This is pretty simple, it's just what group the texture will be displayed under in the Texture Browser. This is for package organization only, and if you only have a few textures in your package just type in "None" or leave this field blank to not assign a group to your new texture.

Name

This is just the name your texture will have inside KFEd. Some types of texture need a specific name (for example the map Level Screenshot. But generally, just give the texture a unique name that you will remember.

Masked

If your texture has Texture Effects (grate effect) then check this box otherwise you'd need to set each surface using the texture to Masked (under surface properties) in order to achieve the same effect.

Generate MipMaps

MipMaps are smoothly downsized versions of your texture that will be displayed when your texture is rendered smaller than its original size (i.e. at a distance). The goal of mipmaps is to make the downscaled textures look smoother than it would if the renderer simply skipped pixels of the original-size texture. Any texture (including those displayed on the HUD or as the level Screenshot) can benefit from mipmaps, but you have to weigh the slight improvement in visual quality against doubling the texture's memory consumption.

When you're all done, just click import and start using the new texture(s) in your level.

Once you've imported your textures into your new package don't forget to click on the Save button to save the new package in the texture folder or else your level will play with the generic bubble texture instead of your new texture. You can edit old texture packs but it is best to only do this with packages that have not yet been publically released (to avoid missing textures and version mismatch errors for your users caused by multiple versions of the package in circulation) and you should never modify the original Epic texture packages bundled with killing floor!

Further Techniques[edit]

  • Level screenshots displayed in KFed's map browser are imported into MyLevel as 256x256 texture with no mipmaps under the name "Screenshot".
  • See exec directive for importing textures into a class on compilation.
  • To import textures from an existing (non-loaded) package into MyLevel, see Embedding Code.

Troubleshooting[edit]

If KFed refuses to import a texture, the most likely problem is that the texture file isn't conform with the rules of the engine. Check off the list of points below. If you know of any other problems, please add them.

Texture size

The width and height must each be powers of two. So the only acceptable numbers are: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. Images larger than 1024x1024 aren't supported (see Unreal Textures) and anything larger than 256x256 will crash UT if you don't allow mipmaps.

Image format

The file must be in 256 color mode when importing from BMP or PCX. If using Photoshop, that's Mode -> Indexed Color. The Exact palette option is fine.

Image Editors

Make sure that your resize your texture before you reduce the color depth when editing. Some image editors such as Irfanview kick the depth back up to 24-bit when resized. From the point of view of image quality it also makes sense to give your image app the largest colourspace to work with when resizing.

File Location

If it still doesn't import then you need to check how deep the texture file is located in your directory structure. Basically when you import a texture in UnrealEd, the pathname and filename will be stored in a string of some kind with a fixed length. So if your directory is too long, the whole thing won't be able to fit in the string and KFEd can't find the texture. The solution is simple: Move the texture(s) you want to import to C:\ for example. Also note, that UnrealEd doesn't like spaces in the pathname.

Exporting[edit]

To export a texture from UnrealEd, go to the texture browser and select the texture you want to export. Do Texture Browser Menu -> File -> Export. Then simply select the directory to save the .TGA file to and export the file. You can then view or edit the file in any image editing program.

Some texture formats won't open properly in standard graphics applications:

  • When exporting TGA files with alpha channels, KFEd does write the alpha information to the file correctly, but writes a TGA file header at the beginning which says that there isn't any alpha information there, so many programs will ignore the alpha data in the file when loading it. To fix this, you can use the Texture Toolkit for UnrealEd to fix the TGA file headers before opening them in other programs.
  • All DXT compressed textures are exported to DDS. RGB8 and RGBA8 textures can be exported to 32-bit TGA, 32-bit UPT, 24-bit BMP or 24-bit PCX and P8 textures can be exported to 8-bit palettized BMP or PCX. You can either open DXT compressed textures using the NVIDIA DDS Photoshop Plug-in, or you can decompress them to TGA for other software using the Texture Toolkit for UnrealEd.
  • UnrealEd will only export G16 textures (used for Terrain heightmaps) as 16-bit grayscale BMP files. The problem is that there's no such thing as a 16-bit grayscale BMP file (the BMP format doesn't support it). UnrealEd actually writes a broken file format which isn't readable by any standard graphics application (and couldn't be even if they wanted to). To use these "broken BMP" files, you will either need to use a program specifically designed for it such as G16ed, or you will need to convert them to a more standard format using something like the Texture Toolkit for UnrealEd.