Page 6 of 18
Re: mapconv
Posted: 05 Feb 2008, 20:07
by Argh
Hmm. Found your code on SVN. I don't see how many mipmap loops it's making. Maybe it's looping down to the smallest mipmap and blowing it up to 32 pixels, but not saving the higher mipmaps? Then the blur was confusing the issue?
Re: mapconv
Posted: 05 Feb 2008, 20:11
by user
there isnt much diference between compressions, dxt 1c is 24 bit 8R8G8B, dxt1a 24 bit is 8R8G8B1A ,
dxt3 is 32bit 8R8G8B8A,
and dxt5 is 32 bit too, but with better alpha.
and dxt3 and 5 is 2 times bigger than dxt1.
my code is not on svn.
and using compressions dxt3 and dxt5 would allow making maps with transparency?
Re: mapconv
Posted: 05 Feb 2008, 20:16
by user
i could make it use ILU for scaling the mipmaps.
Re: mapconv
Posted: 05 Feb 2008, 20:22
by Argh
I don't think that transparency would be supported. The only places where alpha transparency is supported are very specific, in Spring's current renderer.
The main practical difference between DXT3 and DXT5 is that their handling of color values is a bit different, and they render a bit differently on GPUs, depending on the parameters passed to nvdxt.exe (or the equivalent, in nVidia's plugin for Photoshop). I prefer DXT3, but this is ultimately a side issue, and heck, if a DXT3 method works, then you could always add a command-line option to allow users to try the three different levels.
Is it possible to use the -z parameter to force nvdxt.exe? I'll test that...
Re: mapconv
Posted: 05 Feb 2008, 20:26
by user
spring has problems with dxt5, i once used a skybox in dxt5 it did work for some time.
-z is almost useless, but i can make it work.
Re: mapconv
Posted: 05 Feb 2008, 20:32
by Argh
What would be really interesting, imo, is if we could pass arguments to nvdxt.exe or whatever, so that people could get really detailed control over how things were being compressed, etc.
That's all irrelevant. I'm sorry, I'm not sure what else to try here. I haven't seen much else, other than the 4-mipmap thing... maybe it's making a level-4 mipmap of the entire texture, then is finding the tiles, or something equally silly. It's gotta be something "simple" like that...
Re: mapconv
Posted: 05 Feb 2008, 20:37
by user
yes, i am trying to make it now, but the problem is that some programs
need -file as the file parameter, others just need the filename.
nvdxt requires: -file name and [options]
while texcompress requires: name
Re: mapconv
Posted: 05 Feb 2008, 20:59
by user
the problem is how texcompress rescales it, and using nvdxt would create the lines, but im not sure, maybe dxt 3 or dxt 5 wont create the lines
now the -z option will take a filename containing the name of the program and its parameters.
Re: mapconv
Posted: 05 Feb 2008, 22:28
by user
how the new -z option works:
you specify a text file, the text file must have a texture compressor program name, and its parameters, then mapconv will add the filenames to the string. example.
Code: Select all
-z line.txt
in the file:
nvdxt -dxt3 -dither -mitchell -outdir temp\\
another example:
Code: Select all
-z myfilename.txt
in the file:
texcompress
another:
Code: Select all
-z thelist.txt
in the file:
nvdxt -dxt1c
currently only these 2 are suported, more texture compressing programs may be added.
Re: mapconv
Posted: 05 Feb 2008, 22:31
by Argh
Awesome! This is going to be super fun to play with now!
Re: mapconv
Posted: 05 Feb 2008, 22:53
by user
it is almost done,
and do you know any other texture compressor programs?, i want to add
support for more texture compressing programs,
and do you know how to use the nvidia texture tools 2 and texconv? they always give me error messages.
Re: mapconv
Posted: 05 Feb 2008, 23:22
by Argh
Here are all of the arguments for the old nvdxt.exe, which you might want to support (just distribute a version with a different name, like "nvdxt_old", or whatever, this version is for pre-8X series GPUs:
Code: Select all
NVDXT
This program
compresses images
creates normal maps from color or alpha
creates DuDv map
creates cube maps
writes out .dds file
does batch processing
reads .tga, .bmp, .gif, .ppm, .jpg, .tif, .cel, .dds, .png and .psd
filters MIP maps
Options:
-profile <profile name> : Read a profile created from the Photoshop plugin
-quick : use fast compression method
-prescale <int> <int>: rescale image to this size first
-rescale <nearest | hi | lo | next_lo>: rescale image to nearest, next highest
or next lowest power of two
-rel_scale <float, float> : relative scale of original image. 0.5 is half size
Default 1.0, 1.0
-clamp <int, int> : maximum image size. image width and height are clamped
-nomipmap : don't generate MIP maps
-nmips <int> : specify the number of MIP maps to generate
-fade : fade MIP maps
-dither : add dithering
-sharpenMethod <method>: sharpen method MIP maps
<method> is
None
Negative
Lighter
Darker
ContrastMore
ContrastLess
Smoothen
SharpenSoft
SharpenMedium
SharpenStrong
FindEdges
Contour
EdgeDetect
EdgeDetectSoft
Emboss
MeanRemoval
UnSharp <radius, amount, threshold>
XSharpen <xsharpen_strength, xsharpen_threshold>
Custom
-volume <filename> : create volume texture <filename>. Files specified with -l
ist option
-flip : flip top to bottom
-timestamp : Update only changed files
-list <filename> : list of files to convert
-cubemap <filename> : create cube map <filename>. Files specified with -list o
ption
positive x, negative x, positive y, negative y, positive
z, negative z
-all : all image files in current directory
-outdir <directory>: output directory
-deep [directory]: include all subdirectories
-outsamedir : output directory same as input
-overwrite : if input is .dds file, overwrite old file
-file <filename> : input file to process. Accepts wild cards
-output <filename> : filename to write to
-append <filename_append> : append this string to output filename
-24 <dxt1c | dxt1a | dxt3 | dxt5 | u1555 | u4444 | u565 | u8888 | u888 | u555>
: compress 24 bit images with this format
-32 <dxt1c | dxt1a | dxt3 | dxt5 | u1555 | u4444 | u565 | u8888 | u888 | u555>
: compress 32 bit images with this format
-swap : swap rgb
-binaryalpha : treat alpha as 0 or 1
-alpha_threshold <byte>: [0-255] alpha reference value
-alphaborder : border images with alpha = 0
-fadeamount <int>: percentage to fade each MIP level. Default 15
-fadecolor : fade map (color, normal or DuDv) over MIP levels
-fadetocolor <hex color> : color to fade to
-fadealpha : fade alpha over MIP levels
-fadetoalpha <byte>: [0-255] alpha to fade to
-border : border images with color
-bordercolor <hex color> : color for border
-force4 : force DXT1c to use always four colors
Texture Format Default DXT3:
-dxt1c : DXT1 (color only)
-dxt1a : DXT1 (one bit alpha)
-dxt3 : DXT3
-dxt5 : DXT5
-u1555 : uncompressed 1:5:5:5
-u4444 : uncompressed 4:4:4:4
-u565 : uncompressed 5:6:5
-u8888 : uncompressed 8:8:8:8
-u888 : uncompressed 0:8:8:8
-u555 : uncompressed 0:5:5:5
-p8 : paletted 8 bit (256 colors)
-p4 : paletted 4 bit (16 colors)
-a8 : 8 bit alpha channel
-cxv8u8: normal maps
-A8L8 : 8 bit alpha channel, 8 bit luminance
-fp32x4 : fp32 four channels (A32B32G32R32F)
-fp32 : fp32 one channel (R32F)
-fp16x4 : fp16 four channels (A16B16G16R16F)
Optional Mip Map Filtering. Default box filter:
-Point
-Box
-Triangle
-Quadratic
-Cubic
-Catrom
-Mitchell
-Gaussian
-Sinc
-Bessel
-Hanning
-Hamming
-Blackman
-Kaiser
***************************
To make a normal or dudv map, specify one of
-n4 : normal map 4 sample
-n3x3 : normal map 3x3 filter
-n5x5 : normal map 5x5 filter
-n7x7 : normal map 7x7 filter
-n9x9 : normal map 9x9 filter
-dudv : DuDv
and source of height info:
-alpha : alpha channel
-rgb : average rgb
-biased : average rgb biased
-red : red channel
-green : green channel
-blue : blue channel
-max : max of (r,g,b)
-colorspace : mix of r,g,b
-norm : normalize mip maps (source is a normal map)
-signed : signed output for normal maps
Normal/DuDv Map dxt:
-aheight : store calculated height in alpha field
-aclear : clear alpha channel
-awhite : set alpha channel = 1.0
-scale <float> : scale of height map. Default 1.0
-wrap : wrap texture around. Default off
-minz <int> : minimum value for up vector [0-255]. Default 0
***************************
To make a depth sprite, specify:
-depth
and source of depth info:
-alpha : alpha channel
-rgb : average rgb (default)
-red : red channel
-green : green channel
-blue : blue channel
-max : max of (r,g,b)
-colorspace : mix of r,g,b
Depth Sprite dxt:
-aheight : store calculated depth in alpha channel
-aclear : store 0.0 in alpha channel
-awhite : store 1.0 in alpha channel
-scale <float> : scale of depth sprite (default 1.0)
Examples
nvdxt -cubemap cubemap.dds -list cubemapfile.lst
nvdxt -file test.tga -dxt1c
nvdxt -file *.tga
nvdxt -file c:\temp\*.tga
nvdxt -file temp\*.tga
nvdxt -file height_field_in_alpha.tga -n3x3 -alpha -scale 10 -wrap
nvdxt -file grey_scale_height_field.tga -n5x5 -rgb -scale 1.3
nvdxt -file normal_map.tga -norm
nvdxt -file image.tga -dudv -fade -fadeamount 10
nvdxt -all -dxt3 -gamma -outdir .\dds_dir -time
nvdxt -file *.tga -depth -max -scale 0.5
Re: mapconv
Posted: 05 Feb 2008, 23:24
by Argh
Here are all of the arguments for the version shipped with your MapConv (which I assume is this new CUDA thing):
Code: Select all
Version 8.30
NVDXT
This program
compresses images
creates normal maps from color or alpha
creates DuDv map
creates cube maps
writes out .dds file
does batch processing
reads .tga, .bmp, .gif, .ppm, .jpg, .tif, .cel, .dds, .png, .psd, .rgb, *.bw
and .rgba
filters MIP maps
Options:
-profile <profile name> : Read a profile created from the Photoshop plugin
-quick : use fast compression method
-quality_normal : normal quality compression
-quality_production : production quality compression
-quality_highest : highest quality compression (this can be very slow)
-rms_threshold <int> : quality RMS error. Above this, an extensive search is p
erformed.
-prescale <int> <int>: rescale image to this size first
-rescale <nearest | hi | lo | next_lo>: rescale image to nearest, next highest
or next lowest power of two
-rel_scale <float, float> : relative scale of original image. 0.5 is half size
Default 1.0, 1.0
Optional Filtering for rescaling. Default cube filter:
-RescalePoint
-RescaleBox
-RescaleTriangle
-RescaleQuadratic
-RescaleCubic
-RescaleCatrom
-RescaleMitchell
-RescaleGaussian
-RescaleSinc
-RescaleBessel
-RescaleHanning
-RescaleHamming
-RescaleBlackman
-RescaleKaiser
-clamp <int, int> : maximum image size. image width and height are clamped
-clampScale <int, int> : maximum image size. image width and height are scaled
-window <left, top, right, bottom> : window of original window to compress
-nomipmap : don't generate MIP maps
-nmips <int> : specify the number of MIP maps to generate
-rgbe : Image is RGBE format
-dither : add dithering
-sharpenMethod <method>: sharpen method MIP maps
<method> is
None
Negative
Lighter
Darker
ContrastMore
ContrastLess
Smoothen
SharpenSoft
SharpenMedium
SharpenStrong
FindEdges
Contour
EdgeDetect
EdgeDetectSoft
Emboss
MeanRemoval
UnSharp <radius, amount, threshold>
XSharpen <xsharpen_strength, xsharpen_threshold>
Custom
-pause : wait for keyboard on error
-flip : flip top to bottom
-timestamp : Update only changed files
-list <filename> : list of files to convert
-cubeMap : create cube map .
Cube faces specified with individual files with -list option
positive x, negative x, positive y, negative y, positive z, ne
gative z
Use -output option to specify filename
Cube faces specified in one file. Use -file to specify input filena
me
-volumeMap : create volume texture.
Volume slices specified with individual files with -list option
Use -output option to specify filename
Volume specified in one file. Use -file to specify input filename
-all : all image files in current directory
-outdir <directory>: output directory
-deep [directory]: include all subdirectories
-outsamedir : output directory same as input
-overwrite : if input is .dds file, overwrite old file
-forcewrite : write over readonly files
-file <filename> : input file to process. Accepts wild cards
-output <filename> : filename to write to [-outfile can also be specified]
-append <filename_append> : append this string to output filename
-8 <dxt1c | dxt1a | dxt3 | dxt5 | u1555 | u4444 | u565 | u8888 | u888 | u555
| L8 | A8> : compress 8 bit images with this format
-16 <dxt1c | dxt1a | dxt3 | dxt5 | u1555 | u4444 | u565 | u8888 | u888 | u555
| A8L8> : compress 16 bit images with this format
-24 <dxt1c | dxt1a | dxt3 | dxt5 | u1555 | u4444 | u565 | u8888 | u888 | u555>
: compress 24 bit images with this format
-32 <dxt1c | dxt1a | dxt3 | dxt5 | u1555 | u4444 | u565 | u8888 | u888 | u555>
: compress 32 bit images with this format
-swapRB : swap rb
-swapRG : swap rg
-gamma <float value>: gamma correcting during filtering
-outputScale <float, float, float, float>: scale the output by this (r,g,b,a)
-outputBias <float, float, float, float>: bias the output by this amount (r,g,
b,a)
-outputWrap : wraps overflow values modulo the output format
-inputScale <float, float, float, float>: scale the inpput by this (r,g,b,a)
-inputBias <float, float, float, float>: bias the input by this amount (r,g,b,
a)
-binaryalpha : treat alpha as 0 or 1
-alpha_threshold <byte>: [0-255] alpha reference value
-alphaborder : border images with alpha = 0
-alphaborderLeft : border images with alpha (left) = 0
-alphaborderRight : border images with alpha (right)= 0
-alphaborderTop : border images with alpha (top) = 0
-alphaborderBottom : border images with alpha (bottom)= 0
-fadeamount <int>: percentage to fade each MIP level. Default 15
-fadecolor : fade map (color, normal or DuDv) over MIP levels
-fadetocolor <hex color> : color to fade to
-custom_fade <n> <n fadeamounts> : set custom fade amount. n is number number
of fade amounts. fadeamount are [0,1]
-fadealpha : fade alpha over MIP levels
-fadetoalpha <byte>: [0-255] alpha to fade to
-border : border images with color
-bordercolor <hex color> : color for border
-force4 : force DXT1c to use always four colors
-weight <float, float, float>: Compression weightings for R G and B
-luminance : convert color values to luminance for L8 formats
-greyScale : Convert to grey scale
-greyScaleWeights <float, float, float, float>: override greyscale conversion
weights of (0.3086, 0.6094, 0.0820, 0)
-brightness <float, float, float, float>: per channel brightness. Default 0.0
usual range [0,1]
-contrast <float, float, float, float>: per channel contrast. Default 1.0 usu
al range [0.5, 1.5]
Texture Format Default DXT3:
-dxt1c : DXT1 (color only)
-dxt1a : DXT1 (one bit alpha)
-dxt3 : DXT3
-dxt5 : DXT5n
-u1555 : uncompressed 1:5:5:5
-u4444 : uncompressed 4:4:4:4
-u565 : uncompressed 5:6:5
-u8888 : uncompressed 8:8:8:8
-u888 : uncompressed 0:8:8:8
-u555 : uncompressed 0:5:5:5
-p8c : paletted 8 bit (256 colors)
-p8a : paletted 8 bit (256 colors with alpha)
-p4c : paletted 4 bit (16 colors)
-p4a : paletted 4 bit (16 colors with alpha)
-a8 : 8 bit alpha channel
-cxv8u8 : normal map format
-v8u8 : EMBM format (8, bit two component signed)
-v16u16 : EMBM format (16 bit, two component signed)
-A8L8 : 8 bit alpha channel, 8 bit luminance
-fp32x4 : fp32 four channels (A32B32G32R32F)
-fp32 : fp32 one channel (R32F)
-fp16x4 : fp16 four channels (A16B16G16R16F)
-dxt5nm : dxt5 style normal map
-3Dc : 3DC
-g16r16 : 16 bit in, two component
-g16r16f : 16 bit float, two components
Mip Map Filtering Options. Default box filter:
-Point
-Box
-Triangle
-Quadratic
-Cubic
-Catrom
-Mitchell
-Gaussian
-Sinc
-Bessel
-Hanning
-Hamming
-Blackman
-Kaiser
***************************
To make a normal or dudv map, specify one of
-n4 : normal map 4 sample
-n3x3 : normal map 3x3 filter
-n5x5 : normal map 5x5 filter
-n7x7 : normal map 7x7 filter
-n9x9 : normal map 9x9 filter
-dudv : DuDv
and source of height info:
-alpha : alpha channel
-rgb : average rgb
-biased : average rgb biased
-red : red channel
-green : green channel
-blue : blue channel
-max : max of (r,g,b)
-colorspace : mix of r,g,b
-norm : normalize mip maps (source is a normal map)
-toHeight : create a height map (source is a normal map)
Normal/DuDv Map dxt:
-aheight : store calculated height in alpha field
-aclear : clear alpha channel
-awhite : set alpha channel = 1.0
-scale <float> : scale of height map. Default 1.0
-wrap : wrap texture around. Default off
-minz <int> : minimum value for up vector [0-255]. Default 0
***************************
To make a depth sprite, specify:
-depth
and source of depth info:
-alpha : alpha channel
-rgb : average rgb (default)
-red : red channel
-green : green channel
-blue : blue channel
-max : max of (r,g,b)
-colorspace : mix of r,g,b
Depth Sprite dxt:
-aheight : store calculated depth in alpha channel
-aclear : store 0.0 in alpha channel
-awhite : store 1.0 in alpha channel
-scale <float> : scale of depth sprite (default 1.0)
-alpha_modulate : multiplies color by alpha during filtering
-pre_modulate : multiplies color by alpha before processing
Examples
nvdxt -cubeMap -list cubemapfile.lst -output cubemap.dds
nvdxt -cubeMap -file cubemapfile.tga
nvdxt -file test.tga -dxt1c
nvdxt -file *.tga
nvdxt -file c:\temp\*.tga
nvdxt -file temp\*.tga
nvdxt -file height_field_in_alpha.tga -n3x3 -alpha -scale 10 -wrap
nvdxt -file grey_scale_height_field.tga -n5x5 -rgb -scale 1.3
nvdxt -file normal_map.tga -norm
nvdxt -file image.tga -dudv -fade -fadeamount 10
nvdxt -all -dxt3 -gamma -outdir .\dds_dir -time
nvdxt -file *.tga -depth -max -scale 0.5
Re: mapconv
Posted: 05 Feb 2008, 23:26
by Argh
Here are all the arguments for texconv.exe:
Code: Select all
Microsoft (R) D3DX9 Texture Converter
Copyright (C) Microsoft Corp 2001. All rights reserved.
Usage: texconv.exe <options> <files>
-w <n> width
-h <n> height
-d <n> depth
-m <n> miplevels
-f <format> format
-if <filter> image filter
-mf <filter> mip filter
-c <color> colorkey
-srgb{i|o} sRGB {input, output}
-px <string> name prefix
-sx <string> name suffix
-o <directory> output directory
-ft <filetype> file type
-nologo suppress copyright message
<format>: R8G8B8 A8R8G8B8 X8R8G8B8 R5G6B5 X1R5G5B5 A1R5G5B5 A4R4G4B4 R3G3B2
A8 A8R3G3B2 X4R4G4B4 A2B10G10R10 A8B8G8R8 X8B8G8R8 G16R16 A2R10G10B10
A16B16G16R16 A8P8 P8 L8 A8L8 A4L4 V8U8 L6V5U5 X8L8V8U8 Q8W8V8U8 V16U16
A2W10V10U10 UYVY R8G8_B8G8 YUY2 G8R8_G8B8 DXT1 DXT2 DXT3 DXT4 DXT5
D16_LOCKABLE D32F_LOCKABLE L16 Q16W16V16U16 R16F G16R16F A16B16G16R16F
R32F G32R32F A32B32G32R32F CxV8U8
<filter>: NONE POINT LINEAR TRIANGLE BOX NONE_DITHER POINT_DITHER
LINEAR_DITHER TRIANGLE_DITHER BOX_DITHER
<filetype>: BMP DDS JPG HDR PFM PNG
Re: mapconv
Posted: 05 Feb 2008, 23:40
by Argh
Try this:
temp\*.bmp -quality_production -nmips 4 -dither -sharpenMethod SharpenMedium -dxt1
And run it after all of the tiles have been found, and written to .bmps in the Temp folder... much, much faster than doing it for tens of thousands of individual files...
Re: mapconv
Posted: 05 Feb 2008, 23:43
by user
i found a new one, compressonator, havent tested it yet.
and the nvidia tex tools 2, from here:
http://developer.nvidia.com/object/texture_tools.html
these are GPU acelerated, which means 12,5 times faster and higher quality, suport for these would be really good, since on the graph on that site they were using 1536x1536 textures.
edit: the compressonator license doesnt allows redistribuition of it, so
it cant be used.
Re: mapconv
Posted: 05 Feb 2008, 23:48
by Argh
Yeah, they're GPU accelerated, but only for 8X-series GPUs and up. That said, they seem to be backwards-compatible, so it's not that big of a deal. From what I read on nVidia's forums, though, the older nvdxt.exe runs a lot faster in some cases, for older machines.
I've never even heard of compressonator...
Re: mapconv
Posted: 05 Feb 2008, 23:52
by Argh
LOL... ok, it's ATi's belated answer to nVidia's longtime support of DDS.
I will admit, though, that RenderMonkey and I are going to sit down and see if maybe ol' Argh can learn some GLSL if I have a way to do it in a nice, simple GUI...
Re: mapconv
Posted: 05 Feb 2008, 23:55
by user
no i think it works for all, but its faster for 8x series, look at the graph,
for a 8800 2,29 1536x1536 textures where compressed per second,
for a intel duo 0.19 textures, this means it takes around 5 seconds to compress a texture.
for a 8800 a map with 30 tile files would be compressed in a few seconds, since a 8800 can compress around 3-4 102x1024 textures.
Re: mapconv
Posted: 06 Feb 2008, 00:07
by Argh
Meh, as long as it works, it works
Oh, in terms of options...
temp\*.bmp -quality_production -nmips 4 -dither -sharpenMethod SharpenMedium -dxt1 -fadeamount 0
I forgot, the default fades each level, with the expectation that people are using fog in their engines... it'd look terrible in Spring.