Creating High-Quality S3TC/DXT1 Detailed Textures for UE1

Discussion related to the New Vision mod.

Moderator: DaveW

Post Reply
User avatar
kocmo
Thug
Posts: 45
Joined: Mon Mar 17, 2014 11:51 am

Creating High-Quality S3TC/DXT1 Detailed Textures for UE1

Post by kocmo »

Guide On Creating High-Quality S3TC/DXT1 Detailed Textures For Unreal Engine 1

Dave, here's a suggestion on how to embed better-quality DXT1 detailed textures in New Vision. I know you have proclaimed the project done and deleted the intermediate work state, but maybe (just maybe!) you'll find it in your heart to undelete it :-) If not, well, perhaps this instruction might be of use to someone still doing graphical mods under Unreal Engine 1 in this day and age. Here goes:

(1) Produce the high-quality DXT1 textures in .DDS format. Updated renderers (OpenGL, Direct3D 9 and Direct3D 10) don't seem to support DXT5 or uncompressed (A8R8G8B8) textures, but will happily render DXT1 ones. (Ok, if nitpicking, D3D10Drv can use external DDS textures in any format, and D3D9Drv can be recompiled with DXT3/5 support; however, we're talking about embedded detail textures). From my experience, DDS textures exported by Paint.NET have by far the best visual quality, better than AdPDDS.exe (itself relying on Microsoft DirectX runtime), better than Photoshop/GIMP/IrfanView, better than anything. And definitely better than BMP->S3TC conversion algorithm built into UnrealEd 1. Perceptual metrics of Paint.NET simply rock, and with the bulk image processor, you can convert source images into DDS in batch, via File / Bulk Processing.

(2) Create the UTX package containing the new DXT1 textures using UnrealEd 3. I had success with the one bundled with Unreal Tournament 2003. Import textures as .DDS, with texture and group names matching those of the original texture package. This advice is from BeyondUnreal wiki.

(3) Position original and new texture packages appropriately. For example, put original texture package (i.e., DeusExUI.u) into c:\temp\00_old\, put texture package created in step (2) into c:\temp\01_detail_tex\, and create c:\temp\02_merged_pack\. Btw, format of .U and .UTX packages is the same, you can safely rename between them.

(4) Merge the packages using UCC.exe included with UnrealEd 1:

Code: Select all

c:\games\DeusEx\system>UCC.exe mergedxt c:\temp\01_detail_tex\ c:\temp\00_old\ c:\temp\02_merged_pack\
Merged package will be created under c:\temp\02_merged_pack\, and will only contain the textures present both in old package and the new package created in step (2). For example, DeusExUI.u contains 995 textures. If I created a new package containing 500 DXT1 textures, and then merged it with original DeusExUI.u, the resulting merged package will contain only the matching 500 textures.

(5) Here comes the tedious part. Open the newly created merged package in UnrealEd 1 and import all the missing textures (one without DXT1 counterpart) into it. Be aware that UnrealEd 1 limits the texture name to 15 characters. You will probably want to import them using UnrealEd console (Window/Log in UnrealEd) instead. To assemble the import commands, search for "#exec" in your .uc files, and edit them by deleting "#exec " prefix from the string beginning and replacing tabs with spaces. For example, I'd take first import command from DeusExUI\Classes\AllUI.uc:

Code: Select all

#exec TEXTURE IMPORT FILE="Textures\Images\Image01_LibertyIsland_1.pcx"			NAME="Image01_LibertyIsland_1"			GROUP="UserInterface" MIPS=Off
and edit it like this:

Code: Select all

TEXTURE IMPORT FILE="Textures\Images\Image01_LibertyIsland_1.pcx" NAME="Image01_LibertyIsland_1" GROUP="UserInterface" MIPS=Off
Then run it on the UnrealEd console. Make sure you actually have the referenced .PCX textures in the right place :-) You can extract the .PCX textures via "UCC.exe batchexport", or via UModel, ir via other means.

The list of all textures imported by the package is in DeusExUI\Classes\AllUI.uc class for DeusExUI. In case the texture/font import directives are scattered through the source code, you can extract them like this on Cygwin console:

Code: Select all

 egrep -hi "^#exec (TEXTURE|FONT) IMPORT" *.uc | sed "s/#exec //" | sed "s/\t//" > reimport_commands.txt
Make sure you don't reimport manually the textures you've already merged with DXT counterparts.

(5.1) Automating the manual texture reimport procedure.

You might find importing 500-600 textures manually monotonous :-) In that case automate the procedure via AutoIt. Also, if you're creating new 3rd-party texture packs, consider splitting them such that one set of packages will contain only textures to be extended by DXT1 detailed texture counterparts, and the other set will contain only basic textures without DXT1 counterparts. This way you'll save yourself lots of manual work.

Automation procedure:
(5.1.1) Install the full version of AutoIt with SciTE editor, etc.
(5.1.2) Open the file with list of commands (i.e., reimport_commands.txt) in a text editor, which will display the filename in the window title. Notepad++ works.
(5.1.3) Create a new AutoIt script, copy and paste the following into it:

Code: Select all

; editor with list of commands (one per line), and their count
Local $editorTitle = "reimport_commands.txt"
Local $numCommands = 600

; UnrealEd console
Local $unrealConsoleTitle = "Unreal Log Window"

; find editor window, scroll to top-left corner
AutoItSetOption("WinTitleMatchMode", 2)
WinActivate($editorTitle)
AutoItSetOption("WinTitleMatchMode", 1)
Send("^{HOME}")

Local $iLoop = 0
While $iLoop < $numCommands
	; from the editor with list of commands copy one line
	Send("{HOME}")
	Send("+{END}")
	Send("^c")

	; paste it into UnrealEd console, and press Enter
	WinActivate($unrealConsoleTitle)
	Send("^{END}")
	Send("^v")
	Send("{ENTER}")

	; move one line down in editor
	AutoItSetOption("WinTitleMatchMode", 2)
	WinActivate($editorTitle)
	AutoItSetOption("WinTitleMatchMode", 1)
	Send("{DOWN}")

	$iLoop += 1
WEnd

Exit
(5.1.4) Edit the AutoIt script, set $numCommands to the actual number of lines in reimport_textures.txt, plus one. Save it with extension .au3.
(5.1.5) Open UnrealEd 1 from Deus Ex SDK. Open its console (Window / Log). Make the console window larger, so that you can see what's going on.
(5.1.6) Open the AutoIt script you saved in step (5.1.4) with AutoIt SciTE editor. Press F5, the script will run. Don't use your computer during this time, as you'll interfere with script activity; go make some coffee instead :-) Automated texture import speed is 1.63 textures/second on 4.5 GHz CPU.
(5.1.7) Once the automated copying-n-pasting finishes, don't forget to save the changed package in UnrealEd. When you try to exit UnrealEd afterwards, it will likely crash or hang, it's okay :-)

This way you can automate any monotonous & repetitive tasks in UnrealEd or other Windows applications :-)

(6) Rename your new merged package to .u or .utx as needed, move it into the right place, enjoy!

P.S.: "This is the way we’ve always ridden this horse."

P.P.S.: Exporting/importing doesn't work with fonts. You'll need to extract the glyph grid coordinates with UTPT, then redraw the grid on font textures via "-draw" command in ImageMagick (automate it via Perl or Python script), then manipulate the font texture palettes in Paint Shop Pro. Better to stay away from fonts :-)
Gaskoin
Thug
Posts: 22
Joined: Thu Nov 09, 2023 2:12 am

Re: Creating High-Quality S3TC/DXT1 Detailed Textures for UE1

Post by Gaskoin »

Stay ahead of the curve with our exploration of the most wanted and top-rated products of 2023. In this blog, we showcase the products that are making waves in various industries. From tech gadgets to lifestyle essentials, discover https://depositphotos.com/stock-illustrations-and-paintings.html the latest and greatest offerings that are capturing the attention and acclaim of consumers. Elevate your shopping experience with this curated list of top-rated products.
manymanuals1x
Mole Person
Posts: 1
Joined: Fri Jan 05, 2024 5:23 pm

Re: Creating High-Quality S3TC/DXT1 Detailed Textures for UE1

Post by manymanuals1x »

Explore a comprehensive collection of Peavey manuals and instructions at ManyManuals. Whether you're a musician or a sound engineer, https://peavey.manymanuals.com/offers guides for a wide range of Peavey products, including amplifiers, mixers, and speakers. Visit our platform and enhance your audio experience with Peavey.
Post Reply