VanillaTexturePreparationBatchFile

From Step Mods | Change The Game
Icon delete.png This page is a candidate for deletion!
Reason:
"Is this still relevant? Keep, archive, or delete?"
If you disagree with the deletion of this page, please explain why on the discussion page.

Batch file for Preparing Vanilla Textures


IMPORTANT: This batch file should be placed into the working directory alongside the "Vanilla Extracted" directory. Administrative privilege is required.


The best way to get the batch file is to download Batch Files for DDSopt guide.7z (updated 7/26/2013) and dearchive the contents into the working directory. This archive file contains the set of batch files used to automate processing in the DDSopt guide. If that is unavailable, the batch file can be created from the text below. This processing uses the PrepareTexturesforOptimization.bat file from the dowmloaded archive.

Once the BAT file has been created and deposited into the appropriate directory location, run the batch file and when it completes look at the log.txt file to make sure the batch processing worked properly. If it did there will not be any errors shown in the log files. The batch file will take a while to complete; the disk activity light on the computer will come on and off regularly. When it completes the textures are ready for optimization with DDSopt as described in the DDSopt guide.

PrepareTexturesforOptimization BAT[edit]

Copy the following into a text editor, and save as "PrepareTexturesforOptimization.bat":

 

rem last update was on July 29 2013
 
 rem Batch file to perform several tasks to prepare vanilla textures
 rem for optimization using DDSopt.
 rem Like all batch files that change or add files, it needs to be run with Administrative Privilege.
 rem 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)
 rem these characters are often invisible but can cause the batch file to malfunction
 rem DO NOT USE a default Windows text editor to edit this file
 rem Editors like Notepad++ (which was used to create this file), TextPad, UltraEdit are fine
 
 rem It expects that there is a Working directory containing the "Vanilla Extracted" directory
 rem This directory should not be in any User Access Controlled (UAC) directory such as Program Files or Program Files (x86).
 rem It expects that the BSA contents have already been extracted into folders in the  "Vanilla Extracted" directory
 rem It expects a folder in "Vanilla Extracted" labeled "STD"
 rem If the HRDLC are being optimized, the extracted BSA contents should be in "HRDLC1", "HRDLC2", "HRDLC3" in "Vanilla Extracted"
 rem If there are any optional DLC being used their BSAs should have also been extracted into "Vanilla Extracted"
 rem with folder names of "Dawnguard", "Hearthfires", and "Dragonborn" (based on the DLC being used).
 rem
 rem The batch file first copies .png files in the STD folder in "Vanilla Extracted" to the STD folder in "Vanilla Optimized"
 rem The .png files in the DLC BSAs remain there so they don't need to be copied
 rem
 rem To prepare the vanilla textures this batch file copies vanilla texture files (files ending in .dds) from folders 
 rem in "Vanilla Extracted" to "Vanilla Textures" while excluding normal map textures (file names ending in _n.dds and _msn.dds)
 rem from the HRDLC
 rem Any large compressed normal maps (2Kx2K) in the Skyrim - Textures.bsa and the addon DLC BSA are copied to "Vanilla Normal Maps"
 rem The rest of the compressed normal map textures in Skyrim - Textures.bsa and the addon DLC BSA are all low to medium resolution
 rem Since their resolutions are not very high, these are optimized with the rest of the textures without changing resolution
 rem
 rem The batch file copies uncompressed normal map textures from the HRDLC in "Vanilla Extracted"
 rem to the corresponding folders in the "Vanilla Uncompressed Normal Maps" directory.
 rem
 rem Finally, the batch file copies the rest of the normal map textures from the HRDLC in "Vanilla Extracted"
 rem and any large normal maps in the other directories to the corresponding folders (as mentiond above) in the "Vanilla Normal Maps" directory.
 rem
 rem While the batch file runs there will be a command window that echoes the commands
 rem This allows monitoring the progress of the batch processing if desired, although it is not required.
 
IF NOT EXIST "%cd%\Vanilla Textures\NUL"  MD "Vanilla Textures"
IF NOT EXIST "%cd%\Vanilla Normal Maps\NUL"  MD "Vanilla Normal Maps"
IF NOT EXIST "%cd%\Vanilla Optimized\NUL"  MD "Vanilla Optimized"
IF NOT EXIST "%cd%\Vanilla Uncompressed Normal Maps\NUL"  MD "Vanilla Uncompressed Normal Maps"
cd "Vanilla Optimized"
IF NOT EXIST \STD\NUL  MD STD
cd ..

cd "Vanilla Textures"
IF EXIST "..\Vanilla Extracted\HRDLC1" IF NOT EXIST \HRDLC1\NUL  MD HRDLC1
IF EXIST "..\Vanilla Extracted\HRDLC2" IF NOT EXIST \HRDLC2\NUL  MD HRDLC2
IF EXIST "..\Vanilla Extracted\HRDLC3" IF NOT EXIST \HRDLC3\NUL  MD HRDLC3
cd ..

cd "Vanilla Uncompressed Normal Maps"
IF EXIST "..\Vanilla Extracted\HRDLC1" IF NOT EXIST \HRDLC1\NUL  MD HRDLC1
IF EXIST "..\Vanilla Extracted\HRDLC2" IF NOT EXIST \HRDLC2\textures\terrain\NUL  MD HRDLC2\textures\terrain\
IF EXIST "..\Vanilla Extracted\HRDLC3" IF NOT EXIST \HRDLC3\NUL  MD HRDLC3
cd .. 

rem copy the PNG files from Skyrim - textures to the Vanilla Optimized directory
IF EXIST "%cd%\Vanilla Extracted\STD" robocopy "%cd%\Vanilla Extracted\STD" "%cd%\Vanilla Optimized\STD" *.png /s  /nfl /ndl /njh /njs /ns /nc /np >>log.txt
 
rem Copy texture files (from folders other than the HRDLC) to "Vanilla Textures ", excluding any normal map textures
robocopy "%cd%\Vanilla Extracted" "%cd%\Vanilla Textures" *.dds /s  /xd HRDLC1 HRDLC2 HRDLC3 /xf  *_n.dds /nfl /ndl /njh /njs /ns /nc /np >>log.txt
rem Copy small and medium size normal map textures (from folders other than the HRDLC) to "Vanilla Textures"
rem ignore file seruinsmarble01_n.dds that needs to be optimized manually with DDSopt using the associated tga file
robocopy "%cd%\Vanilla Extracted" "%cd%\Vanilla Textures" *_n.dds /s /max:2999999 /xf *seruinsmarble01_n.dds /xd HRDLC1 HRDLC2 HRDLC3  /nfl /ndl /njh /njs /ns /nc /np >>log.txt
rem Copy any large normal map textures (from folders other than the HRDLC) to "Vanilla Normal Maps"
robocopy "%cd%\Vanilla Extracted" "%cd%\Vanilla Normal Maps" *_n.dds /s /min:3000000 /xd HRDLC1 HRDLC2 HRDLC3  /nfl /ndl /njh /njs /ns /nc /np >>log.txt


rem Now copy texture files from the HRDLC to "Vanilla Textures" excluding any normal map textures
IF EXIST "%cd%\Vanilla Extracted\HRDLC1" robocopy "%cd%\Vanilla Extracted\HRDLC1" "%cd%\Vanilla Textures\HRDLC1" *.dds /s  /xf *_n.dds *_msn.dds  /nfl /ndl /njh /njs /ns /nc /np >>log.txt
IF EXIST "%cd%\Vanilla Extracted\HRDLC2"  robocopy "%cd%\Vanilla Extracted\HRDLC2" "%cd%\Vanilla Textures\HRDLC2" *.dds /s  /xf *_n.dds *_msn.dds  /nfl /ndl /njh /njs /ns /nc /np >>log.txt
IF EXIST "%cd%\Vanilla Extracted\HRDLC3" robocopy "%cd%\Vanilla Extracted\HRDLC3" "%cd%\Vanilla Textures\HRDLC3" *.dds /s  /xf *_n.dds *_msn.dds  /nfl /ndl /njh /njs /ns /nc /np >>log.txt

rem Now copy uncompressed HRDLC MSN and terrain TSN texture files to "Vanilla Uncompressed Normal Maps"

IF EXIST "%cd%\Vanilla Extracted\HRDLC1" robocopy "%cd%\Vanilla Extracted\HRDLC1" "%cd%\Vanilla Uncompressed Normal Maps\HRDLC1" *_msn.dds /s   /nfl /ndl /njh /njs /ns /nc /np >>log.txt
IF EXIST "%cd%\Vanilla Extracted\HRDLC3" robocopy "%cd%\Vanilla Extracted\HRDLC3" "%cd%\Vanilla Uncompressed Normal Maps\HRDLC3" *_msn.dds /s   /nfl /ndl /njh /njs /ns /nc /np >>log.txt
IF EXIST "%cd%\Vanilla Extracted\HRDLC2"  robocopy "%cd%\Vanilla Extracted\HRDLC2\textures\terrain" "%cd%\Vanilla Uncompressed Normal Maps\HRDLC2\textures\terrain" *_n.dds /s  /nfl /ndl /njh /njs /ns /nc /np >>log.txt

rem Now copy the rest of the HRDLC normal maps (the compressed normal maps) to "Vanilla Normal Maps"

IF EXIST "%cd%\Vanilla Extracted\HRDLC1" robocopy "%cd%\Vanilla Extracted\HRDLC1" "%cd%\Vanilla Normal Maps\HRDLC1" *_n.dds /s   /nfl /ndl /njh /njs /ns /nc /np >>log.txt
IF EXIST "%cd%\Vanilla Extracted\HRDLC2"  robocopy "%cd%\Vanilla Extracted\HRDLC2" "%cd%\Vanilla Normal Maps\HRDLC2" *_n.dds /s  /xd *terrain  /nfl /ndl /njh /njs /ns /nc /np >>log.txt
IF EXIST "%cd%\Vanilla Extracted\HRDLC3" robocopy "%cd%\Vanilla Extracted\HRDLC3" "%cd%\Vanilla Normal Maps\HRDLC3" *_n.dds /s   /nfl /ndl /njh /njs /ns /nc /np >>log.txt




rem When the batch file processing terminates, check the log file (log.txt). It should not show any errors.

rem this is saved at https://stepmodifications.org/wiki/VanillaTexturePreparationBatchFile


rem ================================END===========