Difference between revisions of "LOD texture fix script"
Jump to navigation
Jump to search
imported>GhanBuriGhan m |
imported>Kienjakenobi |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 2: | Line 2: | ||
This is an applet that replaces the texture assembly routine for LOD landscape textures, which is buggy for some users, resulting in half-black LOD textures. | This is an applet that replaces the texture assembly routine for LOD landscape textures, which is buggy for some users, resulting in half-black LOD textures. | ||
This rough-around the edges solution is based on a script by shaja, to whom I am deeply indebted. I am not a great programmer, and this is my first time messing with | This rough-around the edges solution is based on a script by shaja, to whom I am deeply indebted. I am not a great programmer, and this is my first time messing with Python. Nevertheless, I will try to get an executable version soon. | ||
=What you need= | =What you need= | ||
Line 12: | Line 12: | ||
# Install DDS converter, Phyton and PIL, these are standard windows installs. | # Install DDS converter, Phyton and PIL, these are standard windows installs. | ||
# Create a directory C:\obwrk | # Create a directory C:\obwrk | ||
# Create the partial textures as usual in the CS. See [[ | # Create the partial textures as usual in the CS. See [[Landscape LOD Tutorial]] | ||
# Start the DDS converter | # Start the DDS converter | ||
##In the DDS converter, navigate to | ##In the DDS converter, navigate to your data/textures/landscapelod/generated/partial folder, which holds the generated partial DDS textures. | ||
##Select DDS as the input format | |||
##Select all files | ##Select all files | ||
##Select TGA as the output format | ##Select TGA as the output format | ||
## Select C:\obwrk as the output folder | ## Select C:\obwrk as the output folder | ||
#Start IDLE - the | ## Click the Convert button | ||
## In the menu choose File->New window | #Start IDLE - the Python shell. It should be in your windows start menu. | ||
## In the IDLE menu choose File->New window | |||
## Copy the code below into the new window | ## Copy the code below into the new window | ||
## Save it | ## Save it | ||
## Select Run->Run module | ## Select Run->Run module | ||
## You now have to enter the ID / Hashcode for your textures: Its the first long number in the filename of your partials. | ## You now have to enter the ID / Hashcode for your textures: Its the first long number in the filename of your partials. | ||
## Also enter the Cell coordinates of the upper right hand cell in each of your quads. E.g. 32,32 or 0,32 or 32,0 or 0,0 for the central four quads, respectively. | ## Also enter the Cell coordinates of the upper right hand cell in each of your quads. E.g. 32,32 or 0,32 or 32,0 or 0,0 for the central four quads, respectively. The script will then execute and create a png file with your assembled texture. Repeat this for each quad. | ||
The script will then execute and create a png file with your assembled texture. Repeat this for each quad. | |||
# Go back to DDS converter, and convert the png files back to DDS, using the data/textures/landscapelod/generated folder as the output folder | # Go back to DDS converter, and convert the png files back to DDS, using the data/textures/landscapelod/generated folder as the output folder | ||
# You are done! | # You are done! |
Latest revision as of 19:52, 1 July 2008
By GhanBuriGhan
This is an applet that replaces the texture assembly routine for LOD landscape textures, which is buggy for some users, resulting in half-black LOD textures. This rough-around the edges solution is based on a script by shaja, to whom I am deeply indebted. I am not a great programmer, and this is my first time messing with Python. Nevertheless, I will try to get an executable version soon.
What you need[edit | edit source]
- The DDS converter
- Python (an interpreted scripting language). I used verson 2.4.3.
- Python image library (PIL). 1.1.5 for Python 2.4.
Walkthrough[edit | edit source]
- Install DDS converter, Phyton and PIL, these are standard windows installs.
- Create a directory C:\obwrk
- Create the partial textures as usual in the CS. See Landscape LOD Tutorial
- Start the DDS converter
- In the DDS converter, navigate to your data/textures/landscapelod/generated/partial folder, which holds the generated partial DDS textures.
- Select DDS as the input format
- Select all files
- Select TGA as the output format
- Select C:\obwrk as the output folder
- Click the Convert button
- Start IDLE - the Python shell. It should be in your windows start menu.
- In the IDLE menu choose File->New window
- Copy the code below into the new window
- Save it
- Select Run->Run module
- You now have to enter the ID / Hashcode for your textures: Its the first long number in the filename of your partials.
- Also enter the Cell coordinates of the upper right hand cell in each of your quads. E.g. 32,32 or 0,32 or 32,0 or 0,0 for the central four quads, respectively. The script will then execute and create a png file with your assembled texture. Repeat this for each quad.
- Go back to DDS converter, and convert the png files back to DDS, using the data/textures/landscapelod/generated folder as the output folder
- You are done!
I hope this will help people until Bethesda fixes this little bug
Code:
import os, Image, ImageOps WRKDIR = 'c:/obwrk' name = raw_input ('Enter hashcode ID of texture set ') TRX = raw_input('Enter this quads upper right cell x coordinate ') TRY = raw_input('Enter this quads upper right cell y coordinate ') name = int(name) TRX = int(TRX) + 1 TRY = int(TRY) + 1 BLX = TRX-32 BLY = TRY-32 BL = (BLX,BLY) TR = (TRX,TRY) # actually +1 (fencepost) TILESIZE = 64 os.chdir(WRKDIR) outim = Image.new('RGB', (1024, 1024)) xoffset = 0 yoffset = 0 xrange = range(BL[0],TR[0], 2) yrange = range(BL[1], TR[1], 2) yrange.reverse() for x in xrange: for y in yrange: print "%d.%d.%d.64.tga (%d,%d)" % (name, x, y, xoffset, yoffset) inim = Image.open("%d.%d.%d.64.tga" % (name,x,y)) outim.paste(inim, (xoffset, yoffset)) yoffset += TILESIZE xoffset += TILESIZE yoffset = 0 outim = ImageOps.flip(outim) BLX = BLX-1 BLY = BLY-1 outim.save("%d.%02d.%02d.32.png" % (name, BLX, BLY))