Difference between revisions of "LOD texture fix script"
Jump to navigation
Jump to search
imported>GhanBuriGhan (Created) |
imported>GhanBuriGhan (Link, formatting) |
||
Line 4: | Line 4: | ||
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 Phyotn. Nevertheless, I will try to get an executable verion soon. | 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 Phyotn. Nevertheless, I will try to get an executable verion soon. | ||
=What you need= | |||
* The [[DDS_Tools|DDS converter]] | * The [[DDS_Tools|DDS converter]] | ||
* [http://www.python.org/download/ Phyton] (an interpreted scripting language. I used verson 2.4.3. | * [http://www.python.org/download/ Phyton] (an interpreted scripting language. I used verson 2.4.3. | ||
* [http://www.pythonware.com/products/pil/ Phyton image library (PIL)]. 1.1.5 for Phyton 2.4. | * [http://www.pythonware.com/products/pil/ Phyton image library (PIL)]. 1.1.5 for Phyton 2.4. | ||
=Walkthrough= | |||
# 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. | # 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 C:\obwrk | ##In the DDS converter, navigate to C:\obwrk |
Revision as of 22:19, 5 August 2006
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 Phyotn. Nevertheless, I will try to get an executable verion soon.
What you need
- The DDS converter
- Phyton (an interpreted scripting language. I used verson 2.4.3.
- Phyton image library (PIL). 1.1.5 for Phyton 2.4.
Walkthrough
- 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 C:\obwrk
- Select all files
- Select DDS as the input format
- Select TGA as the output format
- Select C:\obwrk as the output folder
- Start IDLE - the Phyton shell
- In the 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))