## How to add custom textures

Prerequisites:
Everything under The Basics
How to add custom packages (for import method 2 only)

Overview:
Adding at least some of your own textures is a must for giving your map a unique look. There are two basic methods for importing them.

# 1. Create your textures

How you actually create your textures is up to you, but you'll typically want to use one of these products:

Paint Shop Pro costs about $100 and seems to do much of what Photoshop does, at a drastically cheaper price. For creating textures, it should be *more* than enough.
Photoshop usually goes for around $500. If you're lucky enough to have access to this, it is very nice and is an industry standard. I was lucky enough to be able to upgrade to the full version of Photoshop from Photoshop: LE for $100, but since then they've bumped up the price of that upgrade significantly.
Photoshop: LE goes for around $100 and is another good choice. It's a scaled down version of Photoshop, which is cool because you'll be able to follow the many Photoshop tutorials and books that are out there.

There are a number of other photo editing programs that come bundled with scanners, web cams, and digital cameras that may very well do the trick as well. You could theoretically use Windows Paint to create 8-bit BMP files, but you'll be *severely* limited. You could also render images using a 3D animation package. For example, Lightwave has a feature called SkyTracer, which could be used to generate SkyBox textures.

NOTE: There are certain types of effects textures that you create within UnrealEd. I'm not going to cover that topic here, but you can go to Unreal Animating Real-time Textures Manual for more info. These are for creating "algorithmic" animated textures for things like fire, sparks, lightning, and water. They're very cool.

Anyway, even if you initially create textures from scanned-in photographs or from a digital camera, you'll still need to use photo editing software to crop, enhance, and convert the images.

The height and width of your textures need to be "powers of 2." In other words, both the height and the width need to be one of these numbers: 1, 2, 4, 8, 16, 32, 64, 128, or 256. UnrealEd will let you import higher res images (512, 1024, etc), but the Unreal 1 engine will not render those correctly. The height and width do not need to be the same, so a 64 x 32 image is fine.

# 2. Convert your textures

If your textures are already .BMP or .PCX files in 8-bit color, you can skip to step 3. If not, you'll need to use your photo editing software or an image converter to get them into that format. You want to convert your images to 8-bit (256 colors) and save them as either .BMP or .PCX files.

The procedure for this is different depending on which software you use, but I'll give an example of what I do from Photoshop to give you the basic idea.

If I have a 24-bit color image in Photoshop that is cropped and ready to go, this is what I do:

* Select "Save For Web" from the File menu. Though that is designed for conversion to JPG and GIF files, I find the GIF conversion to be excellent. Since GIF files are in 8-bit color, conversion from GIF to PCX is easy.
* Set output format to GIF and adjust dithering options until I have something that looks decent.
* Pull up the GIF file and then choose "Save As" to save it as a PCX file.

If you have a lot of images you need to convert, you might instead use an image conversion utility. A really excellent Freeware image viewer/converter is called IrfanView. The cool thing is that you can do "batch" conversions of entire folders full of files.

The next step is to actually import your textures.

# 3a. Import method 1: Using the UnrealEd user interface

In UnrealEd, make sure "Textures" is selected in the Browse drop-down. Press the Import button at the bottom-right of UnrealEd. Select your texture file (or multiple texture files) and then you'll see this window:

The name of the texture will default to the filename (minus the .pcx or .bmp). The first time you import textures, you'll want to create a new texture package that you'll put all of the textures related to your map in. If you're using this method, you'll need to distribute this .utx file with your map. So make up a name for your new texture package - perhaps the same name as your map or some meaningful category - and type that in the "Package" value. You can also create multiple texture packages, but unless you have a huge number of textures, that's not necessary.

You can type something in the Group value to categorize your texture. This is strictly for convenience when selecting textures in the editor, but it's a good idea. Organize your textures into a small number of categories like "Skins", "Weapons", "UserInterface", "Misc", or whatever. Also, if you type "Ladder" as the Group, your texture will act like a ladder in your map.

Don't worry about the Masked check box for now - masked textures will be covered in a separate tutorial. Also don't worry about the bump map option - I'm pretty sure the Deus Ex version of the Unreal engine does not implement bump mapping.

You usually want to keep "Generate Mipmaps" checked; that option will generate a number of smaller versions of your texture that will automatically be used by Unreal 3D engine. The only time it makes sense to uncheck this is for 2D elements like HUD display icons or DataVault images.

Hit Ok or "Ok to All" and then be sure to press the Save button at the bottom of the Texture Browser to actually save your .utx texture package.

# 3b. Import method 2: Use a .uc file to import the textures into your own package

An alternate method is to use import files to import textures into your own .u package. If you're using your own package anyway, this can be an advantage since that means one less file to distribute. I tend to use this method, but there's no right or wrong way to do it.

For information on setting up your own packages, see How to add custom packages.

Under your package folder, you may want to add a "Textures" folder or something like that.

Create a text file in Notepad or your favorite text editor and type in a texture import line for each texture you want to import. Here's an example of a texture import file:

class Textures expands Object abstract;

// Weapon textures
#exec TEXTURE IMPORT NAME=LaserGunTex1 FILE=Textures\raygun_barrel.pcx GROUP=Skins FLAGS=2

// DataVault images
#exec TEXTURE IMPORT FILE=Textures\Image01_LibertyIsland_1.pcx NAME=Image01_LibertyIsland_1 GROUP=UserInterface MIPS=Off
#exec TEXTURE IMPORT FILE=Textures\Image01_LibertyIsland_2.pcx NAME=Image01_LibertyIsland_2 GROUP=UserInterface MIPS=Off
#exec TEXTURE IMPORT FILE=Textures\Image01_LibertyIsland_3.pcx NAME=Image01_LibertyIsland_3 GROUP=UserInterface MIPS=Off
#exec TEXTURE IMPORT FILE=Textures\Image01_LibertyIsland_4.pcx NAME=Image01_LibertyIsland_4 GROUP=UserInterface MIPS=Off

The value after NAME= is the name that you will reference in UnrealEd. It doesn't have to be the same as the filename. The value after FILE= is the filename. Note that the location is relative to your package folder, so if your textures are in a folder called Textures under your package folder, you'll have to put a "Textures\" in front of the filename. The value after GROUP= is the same as the Group value described in Import Method 1 above.

Save your file as Textures.uc (or whatever you want) in the Classes folder under your package folder. Be sure that the filename matches what's after the word "class" at the top of the file, or you'll get an error when you build your package. You can organize your textures in as many .uc files as you'd like. You can also put texture import statements in with other import statements and even script code if you want to.

There are a couple of optional things you can add to a texture import line. The FLAGS= value is optional. If you don't use a FLAGS value, your texture will be set up with the normal defaults. Here are the valid values you can use:

Texture setting | FLAGS value
Masked | 2
Transparent | 4
Environment mapped | 16
Modulated | 64
Fake Backdrop | 128
Two-sided | 256
Auto U pan | 512
Auto V pan | 1024
No smooth | 2048
Big wavy | 4096
Small wavy | 8192
Water wavy | 16384

Even if you don't set any of these, a surface with your texture on it can still be manually set to any of these later. The "Masked" setting is the most common option.

Another option is the MIPS= value. This works just like the "Generate Mipmaps" option in Import Method 1. If you don't include this, mipmaps *will* be generated. So put MIPS=Off in your import statement if you're importing a 2D element like a HUD icon or DataVault image. (it actually doesn't hurt anything to have the mipmaps generated, but it's a bit of a waste)

To rebuild your package, exit UnrealEd if necessary, delete your .u package file from your \DeusEx\System folder and do a "ucc make" from an MS-DOS command prompt. Fire UnrealEd back up, and your textures will be ready to use.

# 4. Animated textures (optional)

Importing animated textures is very easy. Creating them is the hard part. I'm not going to go into a lot of detail about how to create animated textures - that's up to you. You could take a few frames from some video footage, render some frames with a 3D package, or manually create individual frames in a paint or photo editing package.

For some examples of animated textures, look at the CoreTexMisc package. There are a variety of textures for using on display screens and video screens, such as the ones starting with "News_A".

Using "Texture Import Method 1" described above in step 3a, import a series of textures for your animation frames (that are the same size). Be sure to put 01, 02, 03, etc at the end of the file names. If you do, UnrealEd will automatically detect the sequence as an animation and assign the correct animation values to each texture.

After the textures import, right-click on the first texture in the sequence (in the texture browser). If your textures imported properly, the Animation -> AnimNext value should be set to the second image in the sequence.

Each "AnimNext" value will point to the next image in the sequence until the last texture, which will not have an "AnimNext" value. If you're not seeing any animation when you play your map, you may want to double-check these values.

You may need to experiment with the frame rate of your sequence. A typical animated texture is around 5 - 20 frames long, so a good starting point is around 5 - 10 frames per second. If you don't change the MaxFrameRate and MinFrameRate values, the frame rate will default to a very fast value, and the animation may play faster than you can see it.

To use an animated texture on a brush (or whatever), just use the first texture in the sequence.

To preview the animated texture "in action" in the UnrealEd 3D view, hit the real-time preview button (it looks like this: )

#

# 5. Detail textures (optional)

Detail textures are additional textures that can be "added" to a regular color texture to give it a bit more, uh, texture. They are usually grayscale images that are tiled independently of the main texture and sort of fade in as you get closer to a surface. You could think of them as fake bump mapping, though even that isn't really accurate. They are used to give a texture a bit more depth, such as a stony or metallic surface.

To see an example, load in the HK_VersaLife texture package and select the "cube1" texture. Right-click on it, pull up its properties, and expand the Texture category. Notice that the DetailTexture value is filled in.

Now load in the CoreTexDetail texture and check out the DMetal_A texture. Go ahead and use the cube1 texture in a map to see how it looks. Notice how it changes as you get closer?

The basic idea is to take a base texture and assign it a detail texture. The detail texture gets tiled separately from the main texture, and its scaling and visibility changes with the distance from the player.

The final result looks crappy here since the screenshot is reduced, but in the game it looks pretty decent:

+ =

One thing you can do to if you have a "video display" type of texture is set its DetailTexture value to the CoreTexDetail.DScanline texture. That will give it an "interlaced video" look, though you'd think that in 30 years (or whenever Deus Ex is supposed to be), we'd all be using non-interlaced displays.

You can create your own detail textures; they are just normal textures. For best results, try to make them so they look good when tiled. Also, you may want to make them grayscale, but that's not a requirement.

#

# 6. Ladder textures (optional)

As I mentioned briefly, you can make your own ladder textures. If you set the Group value to "Ladder" when you import a texture (using either import method), your texture will act like a ladder in the game. You'd naturally want to use it on a vertical surface. :) For best results, you may want to investigate "masked textures" which I'll eventually be covering.

Back to main page