In Neverwinter Nights EE, MTR files take precedence over TXI files. This information is only included for reference.
The theory behind the TXI system is to attach properties to a certain texture. When a texture is loaded in game, the engine looks for an accompanying TXI file - recognized by having the exact same name as the texture but with the TXI extension. If the game engine does not find a TXI file, it simply loads the texture by itself. Inside the TXI file can be one or more attributes assigned to the texture, such as texture warping (for water and lava), environment mapping effects, animation, etc.
Note this is a work in progress page - if Bioware didn't use it it probably won't work well/at all, while if they did we might have some notes below on how it works.
Material Specific Fields
These fields go in the TXI file for the base texture. That is, do not specify these fields in the bumpmap or environment map TXI files - they will be ignored.
BumpyShinyTexture
Specify if the environment map to use with a “shinywater” texture. Default is no bumpyshinytexture.
bumpyshinytexture myenvmapname
This parameter is always used in conjunction with the bumpmaptexture parameter “shinywater” (see below).
BumpMapTexture
Specify a bumpmaptexture. Default is no bumpmaptexture. Options are “shinywater”.
bumpmaptexture shinywater
BumpReplacementTexture
This seems to actually load a different texture file for a given texture reference. You could use a dummy file (a 1x1 texture file) have the TXI with this in it and then it loads the final texture
Archived tutorial on the usage that needs recreating on this wiki by OldTimeRadio shows this can be used to mix PLT and DDS on the same model (although not the same node).
This can now be achieved also by shaders.
EnvMapTexture
Specify an environment map for static geometry. Dynamic geometry uses the environment map provided on the model. Default is no environment map.
envmaptexture myenvmapname
Note: A texture specified here overrides the ENVMAP setting in Appearance.2da.
Blending
Specify a blending mode for a material (ie how transparency is dealt with). This blending mode will override the standard mode. Options are "additive", "punchthrough", "default", and "lighten". Default is default.
blending default
Additive
- Used for translucency.
- Equivalent to Add or Linear Dodge, the color is added to whatever is underneath.
Punchthrough
- Used for transparency (e.g. grass, hair, etc.).
Lighten (hold on a second - this doesn't seem to be valid? - needs further testing - Jasperre)
- Used for textures without an alpha channel, makes any pixel colored black transparent..
Alphamean
Specify a transparency setting for a material. This determines how much to “fade out” the alpha channel of the texture.
alphamean 0.563
For performance reasons, it is best practice to specify the alphamean parameter for ANY texture with transparency (i.e. an alpha channel). The TXI files used with the vanilla tilesets are a good point of reference to use in determining alphamean values.
Texture Specific Fields
These fields are applied to the texture being read in. Some are specific to different types of textures (like bump maps) and will be ignored if the TXI belongs to a texture which is not of the same type. I will try to document these cases.
Cube
Defines that the associated texture is a cubemap. Allowed values are 0 or 1. Default is 0.
cube 1
Decal
Renders the texture on top of anything it's flush with. Black areas of texture will be transparent. Allowed values are 0 or 1. Default is 0.
decal 1
DefaultWidth / DefaultHeight
Specify the default width and height of a texture in the absence of an image. These are usually set when you are using a procedural texture. Default for both values is 16
defaultwidth 16
defaultheight 16
ProcedureType
Specify the procedural type. Only use this if a texture needs to be generated procedurally. Options are "water", "life", "perlin", "arturo", "wave" or "cycle". Default is no procedural type.
Note each one does something different:
- water - this animates a texture like water (now replaced by shaders)
- life - unused in the base game "Animates a life texture using the rules of the game of life." "This controller will use, but does not require, that the texture have an image. If an image exists, the initial life state will be set on for a texel if the pixel's red value > lifethreshold (75). Otherwise, a texel will be set on with a probability of lifeprobability% (60)."
- perlin - unused in the base game "This controller generates a Perlin noise function water-like texture."
- arturo - this moves the texture around a little - Globe of Invulnerability for instance (fxpa_globe.txi). "Initializes a wave approximation texture suggested by Erik de Neve of Epic. This texture is generated using a function described by Arturo R Montesinos in a 1994 demo."
- wave - unused in the base game - "Initializes the water texture controller by initializing the velocities array to zero, and the positions array to the heightmap. This controller does not require an image to be present in the texture, but will use one if it is provided."
- cycle - cycles through flames, e g fxpa_flame01
proceduretype arturo
DownSampleMax / DownSampleMin
Specify how the texture can be downsampled. Default is a min of 0, max of 15.
downsamplemax 2
downsamplemin 0
MipMap
Specify whether to mipmap the texture. Valid values are 0 (off) or 1 (on) Default mipmap is on.
mipmap 0
Clamp
Specify which axes the texture cannot wrap on. Valid values are 0, 1, 2, or 3. 1 clamps the X-axis, 2 clamps the Y-axis, and 3 clamps both the X and Y axes. Default is 0, allowing all axes to wrap.
clamp 3
Filter
Specify whether to filter the texture using linear filtering or not. If set to 0, filtering is nearest, otherwise it is linear. Default filtering is linear.
filter 1
Gamma
Specify the gamma correction for this filter. Default gamma correction is 1.0.
gamma 0.5
BumpMap - DEPRECATED
Specify whether this texture is a bumpmap. If this flag is set, the texture module will expect to read in a texture which is grayscale. Default is 0.
bumpmap 1
IsDiffuseBumpMap / IsSpecularBumpMap - DEPRECATED
Specify what kind of bumpmapping this bump map will do: specular, diffuse, or both. These values are ignored if this texture is not a bump map. Default: isdiffusebumpmap 0, isspecularbumpmap 1
isdiffusebumpmap 1
isspecularbumpmap 1
BumpMapScaling - DEPRECATED
Specify a scaling factor for the bumpmap height. If you want higher peaks and lower valleys in the bump map, set the value to be greater than 1. If you want a smoother bump map, set this value to less than 1. Default is set to 1.
bumpmapscaling 1.5
SpecularColor - DEPRECATED
Specify a color for specular bumpmap highlights (RGB). This value is modulated with the bump mapping light's color to produce the final highlight color. Default is (1,1,1).
specularcolor 0.5 0.5 0.8
General Texture Controller Specific Fields
These fields only apply to those textures which are procedural. If these values are specified on a nonprocedural texture, they will be ignored.
ChannelScale / ChannelTranslate
These two fields specify how a procedure should be applied to create a final texture. The scaling factor indicates how much the channels of the final procedural image should be affected by the # procedural result. The translation factor indicates how much to add to the scaled results for each channel.
Default: Channelscale is all 1's, channeltranslate is all 0's. This creates a grayscale semitransparent image based on the procedure.
channelscale 4
0
0.5
0.5
0
channeltranslate 4
0.5
0.5
0.5
0.5
Distort
The following field indicates whether to distort an image using the procedure. This is used for water, lava and all that good 2002 "animated texture" stuff. If this field is set to 1, it requires that an image be provided for this texture. Also, if this value is set to 1, all channelscale and channeltranslate values will be ignored. Default is set to 0.
Note the maximum texture size for using distort 1 is 256x256 (anything above may crash the game) - this is a hardcoded limited in the game engine itself. An alternative is to use spritesheets and emitters. The frame to be used is selected in the emitter properties, not the TXI however.
distort 1
DistortAngle
If this value is set to 1, the texture distortion occurs in an angular fashion. If 0, distortion occurs in a linear fashion. Both are valid but can produce different distortion effects. Default is set to 0.
distortangle 0
DistortionAmplitude
This value indicates how much the texture should be distorted (in texels). If the value is small, the original image will not be distorted significantly. If it is too large, the distortion will generate a very noisy and chaotic result. Default is set to 5.0.
distortionamplitude 3.5
Speed
This value indicates the speed of the procedure. Most procedures can be sped up or slowed down based on this value. Default is 1.0.
speed 2.0
ArturoWidth / ArturoHeight
The following two parameters are used for Arturo procedural textures. The actual arturo function is calculated using the size specified in these parameters and is then upsampled to the size of the texture. You may be able to get better results by tinkering with these, although the default values work very reasonably. Default is 15 for both.
arturowidth 17
arturoheight 17
Field List
From the source code these are all the valid fields. As mentioned at the top of this page many may not work as expected or at all, but are, at least, not going to crash the engine if included.
Texture Related Fields
proceduretype filerange defaultwidth defaultheight downsamplemax downsamplemin mipmap filter maptexelstopixels gamma isbumpmap clamp alphamean isdiffusebumpmap isspecularbumpmap bumpmapscaling specularcolor numx numy cube bumpintensity temporary useglobalalpha isenvironmentmapped pltreplacement
Font Related Fields
numchars fontheight baselineheight texturewidth spacingR spacingB caretindent upperleftcoords lowerrightcoords isdoublebyte fontwidth numcharspersheet dbmapping cols rows The 8193.24 preview patch adds these parameters for fonts: ttfContrast ttfOutlineOpacity ttfOutlineBrightness
Material Related Fields
bumpmaptexture bumpyshinytexture envmaptexture bumpreplacementtexture blending decal
2 Comments
Jasperre
A note for when we write a page about lovely water; use a TXI file with these two lines to just allow the EE games much nicer water;
bumpyshinytexture ttr01__env
bumpmaptexture shinywater
From merricksdad
Jasperre
In an MTR you can also force new water with these lines;
customshadervs vswater
customshaderfs fswater
There is also additional TXI settings needed if you do want to support the "old water" which players can technically still set the game to use.