I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX
Legacy:Texture Import And Export
Import from Graphics File
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:
- If you want to save the image in an external package, just enter the package name. If it does not exist, UnrealEd 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.
- 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.
- This is just the name your texture will have inside UnrealEd. Some types of texture need a specific name (for example the map Level Screenshot in UT). But generally, just give the texture a unique name that you will remember.
- 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 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 Unreal Tournament!
- Level screenshots displayed in UT's map browser are imported into MyLevel as 256x256 texture with no mipmaps under the name "Screenshot". See Screenshot (UT) for full instructions.
- 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.
If UnrealEd 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 UnrealEd 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.
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, UnrealEd 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.
Foxpaw: I have a texture that I want to import into UnrealEd. This texture is very high resolution - roughly 8000x4000. I mostly want to try importing this texture simply to see what the UnrealEngine2 can accomplish given very high-polygon, high-detailed art assets.
Now, the problem that I'm having is, UnrealEd crashes on import if I uncheck "generate mipmaps" on texture import. If I generate the mipmaps, however, I just get a mipmap, which, though theoretically it should be indistringuisable, is actually quite noticeably degraded from what the texture looks like in the texture browser.
So my question is, is there any way to import a giant texture without mipmaps, or any way to "weight" the mipmaps differently? The mipmaps that I'm seeing are clearly lower detail maps than should be displayed at that distance and resolution.
Graphik: I realize that you're just trying to push the engine to it's limits, but I don't think that an 8000x4000 texture will really yeild much, if any, improvement.
Foogod: A couple of things in response to this: First, as far as I know, texture dimensions must always be a power of two, so if you've actually got an 8000x4000 image, that might be part of the problem. Try making it, say, 8192x4096 instead. Second, even assuming that the engine can handle a texture like this, it's quite likely that most 3D hardware rendering won't, and it's possible that the reason you're seeing a degraded texture is because the engine had to use a lesser mipmap when passing it to the video card to make it something that the hardware could actually display. In this case, there's probably not a lot you can do until new video cards come out which can handle this kind of insanity.
EricBlade: From what I understand, UEd can handle up to 2048x2048, though I haven't heard of anyone actually using that. I imagine much like if you try to import a static mesh that's greater than around 20,000 polys, it will simply stop importing somewhere around 20,000 and leave you with a pile of garbage, it probably does about the same thing with insane texture sizes.
Ben: Is there a way to load DYNAMICALLY a texture, or a package including a texture during the execution of unreal?
The goal is to not have to stop and restart unreal.
I've got the idea (didn't tested yet) to make a class that has the statement #exec TEXTURE IMPORT NAME=SomeTex1 FILE=Textures\SomeTexture.pcx GROUP=Skins FLAGS=2
and when I need it inside unreal to "summon" this class.
Do not seams really the best, so any other idea?
Wormbo: UnrealScript code can use the DynamicLoadObject() function to load objects like Textures from Unreal packages. Importing textures from disk at runtime is not possible, though. The #exec directives are only executed at compile time.
Switch`: In theory it's possible with 3rd party application running in the background. The app could receive file import details from unrealscript via TCP, import a texture into package (ie using one of the ucc commandlets) with unique name, then send the filename back to unrealscript, where the texture would be loaded at runtime with DynamicLoadObject().