Guide:DDSopt/Batch Files/02 ReadMe-Pre-Optimization

From Step Mods | Change The Game

This Batch file to perform several tasks to prepare vanilla textures for optimization using DDSopt, as described in the DDSopt guide ( https://stepmodifications.org/wiki/Guide:DDSopt ) .

Like all batch files that change or add files, it needs to be run with Administrative Privilege.
If this batch file is edited, this MUST BE DONE with an editor that does not add additional characters (e.g., line feed, carriage return).
These characters are often invisible but can cause the batch file to malfunction.
DO NOT USE a default Windows text editor to edit this file. Editors like Notepad++ (which was used to create this file), TextPad, UltraEdit are fine.
 
The batch file expects that there is a Working directory containing the "Vanilla Extracted" directory.
The batch file itself also needs to be located in this directory.
This directory should not be in any User Access Controlled (UAC) directory such as Program Files or Program Files (x86).
It expects that the BSA contents have already been extracted into folders in the  "Vanilla Extracted" directory in the Working Directory
If the Skyrim - textures.bsa textures are being optimized, it expects a folder in "Vanilla Extracted" labeled "STD".
If the HRDLC are being optimized, the extracted BSA contents should be in "HRDLC1", "HRDLC2", "HRDLC3" in "Vanilla Extracted".
If there are any optional DLC being used their BSAs should have also been extracted into "Vanilla Extracted", with folder names of "Dawnguard", "Hearthfires", and "Dragonborn" (for the particular DLC BSAs being optimized).

Operation of the batch file
The batch file first copies .png files in the STD folder in "Vanilla Extracted" to the STD folder in "Vanilla Optimized".
The .png files in the DLC BSAs remain in the BSA file so they don't need to be copied.

To prepare the vanilla textures this batch file copies vanilla texture files (files ending in .dds) from folders in "Vanilla Extracted" to "Vanilla Textures" while excluding normal map textures (file names ending in _n.dds and _msn.dds) from the HRDLC.
Any large compressed normal maps (2Kx2K) in the Skyrim - Textures.bsa and the addon DLC BSA are copied to "Vanilla Normal Maps".
The rest of the compressed normal map textures in Skyrim - Textures.bsa and the addon DLC BSA are all low to medium resolution.
Since their resolutions are not very high, these are optimized with the rest of the textures (in "Vanilla Textures") without changing resolution.

The batch file copies uncompressed normal map textures from the HRDLC in "Vanilla Extracted" to the corresponding folders in the "Vanilla Uncompressed Normal Maps" directory.

Finally, the batch file copies the rest of the normal map textures from the HRDLC in "Vanilla Extracted" and any large normal maps in the other directories to the corresponding folders (as mentiond above) in the "Vanilla Normal Maps" directory.

While the batch file runs there will be a command window that echoes the commands. This allows monitoring the progress of the batch processing if desired, although it is not required.

When the batch file successfully completes the temporary directories "Vanilla Textures", "Vanilla Normal Maps", and "Vanilla Uncompressed Normal Maps", and their contents, can be deleted.

For almost every copy operation the batch processing checks to see whether the related vanilla BSA folder in "Vanilla Extracted" is present. This allows the batch processing to be used incrementally. For example, if a new DLC is added the batch file can be run, and then DDSopt on each of the intermediate folders. The output folder in "Vanilla Optimized" can then be archived and added it to the game. This can be done with any of vanilla BSAs.

The directory names used can be changed if desired, but if this is done the names will not correspond to the names used in the documentation in the DDSopt guide.