In order to provide some insight into what my new
F-TexTools are up to before downloading, I have displayed the README file of the above archive below:
----------------------------
README: F-TexTools-1.0pre1 ----------------------------
This distribution contains a set of 6 custom command-line tools for generating huge textures or optimized texture tiles of highest quality for the 3D space simulation Celestia,
http://www.shatters.net/celestia/ or similar environments. No image manipulation expertise is required.
These tools perfectly complement our nmtools package for generating highly optimized normal maps or tiles thereof on standard home computers.
Special attention has been paid to allow for very big textures (>= 64k x 32k) to be handled even by average sized home computers. The tools work directly with the original scientific imaging data for Earth, Mars etc. The execution speed is high due to optimized custom algorithms.
Highlights are
- sources compile cleanly for Windows and Linux PC's,
as well as both PPC and Intel MACs;
- executables are included for Win32, Linux, OSX-universal;
- throughout, the tools work between STDIN and STDOUT,
and therefore may be piped together in a module fashion as needed;
- a brief help text is printed, if the tools are executed without any
parameters;
- the 6 texture tools are designed quite similarly to the nmtools package
for normal maps by F. Schrempp and R. Skuridin.
- My new F-TexTools AND the updated nmtools now output PNG format in order
to be able to directly compress them into high-quality DXT and DXT5nm format, respectively, by means of the new OpenSource & cross-platform NVIDIA-texture tools!
Specifically:
Code:
1) tx2pow2
==========
Usage: tx2pow2 <channels> <width> [<height> [<#headerlines>]]
---------------------------------------------------------------
The program reads textures in unsigned 8 bit integer raw format
from STDIN. It outputs to STDOUT a texture of width reduced to
the nearest power of 2 in the same format.
---------------------------------------------------------------
Assume : Interleaved RGB ordering (RGB RGB RGB RGB...) for RGB color textures.
Defaults: Inputwidth : inputheight = 2 : 1.
No header (#headerlines = 0).
For 3 x 8 bit RGB colored textures enter channels = 3.
For 1 x 8 bit grayscale textures enter channels = 1.
For different aspect ratios enter <height> in pixels.
For PDS .img, .edr,...format enter #headerlines = 2,....
2) tx2half
==========
Usage: tx2half <channels> <width> [<height> [<#headerlines>]]
----------------------------------------------------------------
The program reads textures of even size in unsigned 8 bit
integer raw format from STDIN. It outputs to STDOUT a texture
of size reduced by a factor of two in the same 8 bit raw format.
----------------------------------------------------------------
Assume : Interleaved RGB(A) storage mode ie. RGB(A)RGB(A)RGB(A)..
for RGB (+ alpha) textures
Defaults: Inputwidth : inputheight = 2 : 1.
No header (#headerlines = 0).
For 4 x 8 bit RGB + alpha textures enter channels = 4.
For 3 x 8 bit RGB colored textures enter channels = 3.
For 1 x 8 bit grayscale textures enter channels = 1.
For different aspect ratio, enter <height> in pixels.
For PDS .img, .edr,...format enter #headerlines = 2,....
3) tx2rgba
==========
Usage: tx2rgba <width> <specmap name> [<height>]
------------------------------------------------------------------------
The program reads a RGB map in 3 x 8 bit integer raw format from STDIN
and a specular graymap of same dimensions in 1 x 8 bit raw format.
The specmap is mounted as the alpha channel of the resulting RGBA map
The latter is output at STDOUT in 4 x 8 bit unsigned integer raw format.
------------------------------------------------------------------------
Default : height = width / 2.
4) specmap
==========
Usage: specmap <width> <watermask name> [<light> [<byteswap>]]
------------------------------------------------------------------------
The program reads an elevation map in signed 16 bit integer raw format
from STDIN and the BMNG watermask of same width in 8 bit unsigned
integer raw format via the command line. In the heightmap, oceans are
found from 'elevation == 0'. The result is bitwise OR-ed with (the
complement of) the watermask to improve the precision of the ocean
boundaries of the latter. The resulting specmap is output at STDOUT
as a graymap in 8 bit unsigned integer raw format.
------------------------------------------------------------------------
Assume : height = width / 2.
Default: Byte ordering of input heightmap and computer are equal,
else specify <byteswap> = 1.
The light fraction of the land defaults to 0.0 (black),
and may be increased by specifying <light> (< 1).
A recommended value is light = 0.12.
5) bin2png
==========
Usage: bin2png <channels> <width> [<height> [<#headerlines>]]
----------------------------------------------------------------------
The program reads textures in unsigned bpp x 8 bit integer raw format
from STDIN and converts them to PNG format at STDOUT.
----------------------------------------------------------------------
Assume : Interleaved RGB(A) ordering (RGB(A)RGB(A)RGB(A)...).
: PNG_compression = 6; (0..9(slow!))
Defaults: Inputwidth : inputheight = 2 : 1.
No header (#headerlines = 0).
For 4 x 8 bit RGB + alpha textures enter channels = 4.
For 3 x 8 bit RGB colored textures enter channels = 3.
For 1 x 8 bit grayscale textures enter channels = 1.
For different aspect ratios enter <height> in pixels.
For PDS .img, .edr,...format enter #headerlines = 2,....
6) txtiles
==========
Usage: txtiles <channels> <width> <level> [<PNG_compression>]
--------------------------------------------------------------------
The program reads textures in unsigned bpp x 8 bit integer raw format
from STDIN. It outputs VT tiles with many optimizations in PNG format.
--------------------------------------------------------------------
Units : tilesize[pixel] = width/2^(level+1).
Input : Interleaved RGB(A) storage mode ie. RGB(A)RGB(A)RGB(A)...
for RGB (+ alpha) textures
Inputwidth : inputheight = 2 : 1, power-of-two size.
No header.
Default : PNG_compression = Z_BEST_SPEED = 1
: best choice for subsequent DXT compression!
For VT tiles in PNG format, enter PNG_compression = 6..9 (slow!)
For 4 x 8 bit RGB + alpha textures enter channels = 4.
For 3 x 8 bit colored textures enter channels = 3.
For 1 x 8 bit grayscale textures enter channels = 1.
+++++++++
Examples:
+++++++++
We assume that the compression tool gzip has been installed on the local computer.
Gzip for Windows may be downloaded from here:
http://gnuwin32.sourceforge.net/packages/gzip.htmFor Linux and MAC-OS gzip is part of the system installation.
Assumptions:
^^^^^^^^^^^
<RGB>.bin.gz =>
-- is gzipped (<=> gz file ending)
-- has width = 86400 pixels (!)
-- aspect ratio = 2:1
-- is a RGB (base) texture (bpp=3) in 3 x 8 bit raw format
<outfile>.png =>
-- is output file in PNG format;
<watermask>.bin =>
-- has width = 86400 pixels (!)
-- aspect ratio = 2:1
-- is a watermask graymap texture (bpp=1) in 1x8 bit raw format
<elevation_map>.bin.gz =>
-- is gzipped (<=> gz file ending)
-- has width = 86400 pixels (!)
-- aspect ratio 2:1
-- is an elevation graymap in signed 1x16 bit raw format
-- endedness of stored elevation file = endedness of computer
Tasks:
^^^^^
1) Reduce the binary input file of width = 86400 pixels to the nearest power-of-two dimension (65536 x 32768); then reduce it to only 16384 pixels and convert it to PNG output format (PNG_compression = 6).
Code:
gzip -dc < <RGB-infile>.bin.gz | tx2pow2 3 86400 | tx2half 3 65536 | tx2half 3 32768 | bin2png 3 16384 > <outfile>.png
Linux: 11.5 min on my 3.2 GHz P4 / 3 GB RAM machine
2) Generate a much improved specmap in 1 x 8 bit raw format of width = 65536 pixels from the official BMNG watermask and the 16 bit elevation graymap with recommended residual light level = 0.12 for the land areas.
Code:
gzip -dc < <elevation_map>.bin.gz | specmap 86400 <watermask>.bin 0.12 | tx2pow2 1 86400 > <specmap>.bin
Linux: 4.1 min on my 3.2 GHz P4 / 3 GB RAM machine
3) Read a 3x8 bit gzipped RGB base texture of width = 86400 pixels from STDIN and mount the improved specmap texture of the same width as alpha channel of the resulting RGBA map. Subsequently, generate a set of 2048 optimized RGBA VT tiles of level 5 in PNG format.
Code:
gzip -dc < <RGB-infile>.bin.gz | tx2rgba 86400 <specmap>.bin | tx2pow2 4 86400 | txtiles 4 65536 5
Linux: 16.6 min on my 3.2 GHz P4 /3 GB RAM machine
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I cordially thank
Da Woon Jung <dirkpitt2050@users.sf.net>
for his active help to make the code run on MACS. He compiled the tools as "OSX-universal", meaning they contain both PPC and Intel code and run natively on both PPC and Intel MACs.
Enjoy,
Fridger Schrempp
----------------------------
Copyright: Dr.Fridger Schrempp, <fridger.schrempp@desy.de>