Difference between revisions of "LOD texture fix script"
imported>ShadowDancer m (typo) |
imported>DragoonWraith (bylined) |
||
Line 1: | Line 1: | ||
{{Byline}} | |||
By [[User:GhanBuriGhan|GhanBuriGhan]] | By [[User:GhanBuriGhan|GhanBuriGhan]] | ||
Revision as of 12:57, 26 August 2007
This article has been bylined by a contributor. Current rules do not allow bylines in mainspace articles, but articles written before August 2007 may have been bylined prior to the rules. If you are the original author, please comment on this in the Talk page.
If you are not the bylined author, please treat this article with respect. While this is a Wiki and this article is considered open for editing, courtesy is expected. If at all possible, please contact the bylined author about any changes you would like to make.
As always, see the Edit History to see who has contributed to the page, and use the Talk page if you have any questions regarding its content.
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
- 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
- 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 all files
- Select DDS as the input format
- 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))