OHM Texbuild

OrbitHangar

Addon Comments
Joined
Apr 9, 2008
Messages
3,832
Reaction score
18
Points
0
Author: nerull

A command line app to build planet tetures up to level 8, allows more format control than pltex.

Aside from curiosity, this was mostly made to allow use of other DXT formats. It currently supports DXT1, DXT5 (Possibly useless in orbiter, but its there), and uncompressed RGB.

This will allow lowish-res planet addons without compression artifacts. The downside is larger files, and I really wouldn't recommend using RGB for anything over level 7, but its possible.

There is another command line option I forgot to document in the README, to set the 'base' texture resolution, which is by default 256x256. It can be specified with -b<number>. This can increase the resolution of any 'level' in orbiter. The size must be a power of two, but the program does not check. Experiment with this feature at your own risk.

The Python sourcecode is included, and MIT licensed, so anyone is free to extend or use this code in any other project.

***UPDATE***

Fixed a bug with Level 5 textures, and switched to texconv for DXT compression, which is significantly faster. Now uses a modified version of nvcompress (added batch support) for RGB, since texconv RGB files do not seem to work in Orbiter.



DOWNLOAD
 
Updated with bug fixes and speed improvements. Processing and DXT1 compression went from 41 seconds (With CUDA) to 14 seconds without CUDA using texconv from the DirectX SDK.

Unfortunatly the RGB files created by texconv do not seem to work in Orbiter - planets turn white. I modified the nvcompress code to add batch support (it previously only operated on one file at a time, requiring it to be run 501 (!) times for a level 8 texture. Even with with CUDA, that was very slow.

I do not have the CUDA SDK, so I had to compile without CUDA support. I was going to use this for both RGB and DXT, since it seemed nice and fast with RGB, but then I discovered that NVIDIA's non-CUDA DXT compressor is horribly slow, taking over a second for each file. I now include both compressors and switch between them depending on format. The tool is much faster than the previous version in both cases.

I also fixed a bug with Level 5 textures where the southern hemisphere was flipped. I didn't catch it at first because its only visible in the distance range where level 5 textures are used.
 
Thank you Nerull

I try to understand progressively the pltex'job (for which I kept a lot of documents; it remains me to find the time to do the synthesis...if i nevertheless did some successful experiences with it). But to have access to an alternate tool, is really a godsend.

Thank you again
 
Still quite a bit to implement left, such as night lights and specular mapping. I have not yet examined the format in detail, but I think night lights is just a matter of processing the night texture in a similar manner. Specular reflections requires building the binary data file to go with it, but the source code for that format is in OrbVis, so its doable.
 
I can't get it to work. As soon as it opens it closes.:shrug:
 
I can't get it to work. As soon as it opens it closes.:shrug:
Texbuild is a command line application, that prints its messages out to console window.

Did you read included README.txt for its usage?

It probably printed "Must specify an image file!" message, and just closed, if you run it without parameters (e.g. you didn't drag a file on it, or provide a file name as an argument).

Try to run it from console window (cmd).
 
When I converted it, the new .tex file's size was 0 KB

---------- Post added at 03:16 PM ---------- Previous post was at 03:00 PM ----------

Also I am getting a error saying " IOError: [Errno 2] No such file or directory: 'out\\dds\\tex_0.dds' "

You used a BMP file that is 24 bpp (R8 G8 B8). You need to save it as 32 bpp BMP (A8 R8 G8 B8), or as PNG or TGA file.
 
I'm having a problem when I try to use this program. When I try to process a 8192x4096 .png file, I get an error message that says "No such file or directory". Here's the output.

C:\...\texbuildexe>texbuild -l6 cloud_combined_8192.png
Processing level 1...
Processing level 2...
Processing level 3...
Processing level 4...
Processing level 5...
Processing level 6...
Converting to DDS...

Building .tex...
Traceback (most recent call last):
File "texbuild.py", line 239, in <module>

File "texbuild.py", line 131, in main
buildtex(outfn, fmt, level)
File "texbuild.py", line 231, in buildtex
tmpfile.close()
IOError: [Errno 2] No such file or directory: 'out\\dds\\tex_0.dds'



Can anyone help me and let me know if I'm doing something wrong?

---------- Post added at 08:48 PM ---------- Previous post was at 06:12 PM ----------

I think something is happening with the texconv call in texbuild.py, because there are no .dds files in the dds folder. Texbuild looks for them after texconv was supposed to convert the .tga files to .dds, and doesn't find them, so it blows up.

I'm looking at the texbuild.py file, but I haven't figured out how to run it properly to debug it instead of running the exe. I get errors at the very beginning when it tries to import the libraries. Unzipping the library.zip and dumping it into the same folder as texbuild.py then gives me an error about some invalid magic number inside the Image library.

I tried manually converting the .tga files into .dds, but whenever I run texbuild, the new .dds files are erased from the folder and the same old error message appears.
 
I found out my problem. I needed to download and install the DirectX SDK from Microsoft, and then run texbuild.exe. It works fine now. It seems that texconv.exe has some dependencies that are not included with texbuild.
 
Back
Top