Textures

From NWN1 Custom Content Guide

Jump to: navigation, search

Contents

[edit] Overview

A texture is an image which is applied on the 3D model to give details.

It is used instead of having to model the geometry out, as NWN (as is most video games) are low poly games. It's a fine balancing act between geometry and textures, to get the best effect for your model.

NWN stores textures in 2 methods: as a low res .TGA and a higher resolution .DDS. At the same time, the .DDS is stored in 3 texture packs, one of which is used depending on the amount of video card memory available (16mb or lower, 32mb, and 64mb).

The .TGA textures are stored in:

  • /nwn/data/textures_01.bif - creatures, helms, inventory icons, mini-map images
  • /nwn/data/textures_02.bif - mostly PC body part .PLTs and inventory icons, portraits
  • /nwn/data/aurora_[tilesetname].bif - low res .TGA for the tiles

The .DDS is in /nwn/texturepacks/ in multiple files:

  • textures_???.erf - general textures
  • tiles_???.erf - for tile related textures
  • xp1_tex_???.erf - for XP1, SoU
  • xp2_tex_???.erf - for XP2, HotU

The texture pack's suffix relates to the size, TPA for 64mb, TPB for 32mb and TPC for 16mb and lower.

If you wish to editing the texture, ALWAYS grab them from the .DDS, as the .TGA version in the data BIF's are really low res and only there for compatibility with video cards that do not support DirectX 8 and .DDS textures. Use the Extract as TGA feature of NWN Explorer to skip having to extract the .DDS and run it through a .DDS to .TGA converter, as NWE will automatically extract the highiest size out of the .DDS (usually 512x512).

[edit] TGA vs. DDS

  • Why DDS over TGA?
  • Explain technical differences
  • File storage
  • How DDS is stored
  • Why multiple resolutions
Resolution Size Size w/Alpha
512x512 768kb 1mb
256x256 192kb 256kb
128x128 48kb 64kb
64x64 12kb 16kb
32x32 3kb 4kb
16x16 768 bytes 1kb

[edit] PLT Textures

PLT textures seem to have been a thing of mystery for some time. The key to understanding how they work rests in appreciating that the whole PLT system is designed to allow you to index into a TGA file that holds a range of colours. This discussion will assume you are working with PhotoShop and the Bioware PLT exporter plugin. This means we will be ignoring the colour channel dance used with utilties like pltcon.

So what is a PLT. It is a file format that holds grey scale images which have been built from collapsing a number of grey scale images. There are up to 10 image layers, which are (starting from the top):

  1. tattoo2
  2. tattoo1
  3. leather2
  4. leather1
  5. cloth2
  6. cloth1
  7. metal2
  8. metal1
  9. hair
  10. skin

These are the layers you would setup in PhotoShop. Each layer when stored in the PLT references to a palette file in the game. These palette files have strips of colours 256 pixels wide and 1 pixel high. This strip of colour will be refered to as a Row. Each pixel in the Row is a Column. Remember there are multiple Rows in these palatte files.

Now we have some of the basics out of the way. How dow the gray scale layers get their colours when combined into a PLT file and used in game? Easy.

  1. The layer number tells the game what palette file to use for that layer
  2. The gray scale values (0 to 255) of the pixels in the layer tell the game what Column offset into the palette file to use
  3. The colour selection used by the builder in the ToolSet for the body/armour part tells the game what Row offset into the palette file to use

That's it. Essentially the information from the layer number, grey scale data in the layer and the builders toolset colour choices provide 3 dimensional array index data to identify the colour to use when rendered in game.


Some quick HOW to EDIT PLT info with links to plugins:


[edit] PLT EDITING TIPS:

A. BEST WAY

1. Use NWNexplorer to extract old game plts from the texture pack. Assuming you are editing a game plt. If starting a new plt from scratch, set up a 10 layer (order matters grayscale psd (photoshop) file - some tech info is above

2. Use Joco's plt plug in script to convert the old plt (if editing an old one) into the proper 10 greyscale layers used to make the plt - the layers will even be ordered correctly and labeled skin, hair, cloth1, ... through tattoo 2 for you :D http://nwvault.ign.com/View.php?view=other.Detail&id=670 and you will need GIMP (a free paint program) to use this script as sadly James (joco) has never found photoshop script commands that will do this ! LOL Once extracted into layers into GIMP (google for Gimp - its not hard to find) - save the file as a PSD (photoshop)file

3. Open the PSD in photoshop and edit the layers as needed. You can also continue the editing in GIMP but you cannot use biowares export script with GIMP (sheesh - I know...)

4. Get the BioWare plt export script NOTE: it only works with Photoshop but it does work even with the cheep/feebee photoshop elements version. Also it includes a few templates http://nwn.bioware.com/downloads/misc.html and export the new plt. Put the new PLT in a hak if you want to override the original game textures. Note:using the override folder alone does not override original game plt textures but it is fine for new models and such.

B. I don't use this way any more BUT If you don't have Photoshop it works.

1. Same as above 2. Use pltcon to convert to bmp, open in your paint program and convert to RGB color channels then at step 3. continuing using GIMP or other paint program. Set up the color channels correctly, recombine into a bitmap and save, then use pltcon to convert it back to plt. color channel tutorial http://nwvault.ign.com/View.php?view=Other.Detail&id=524 pltcon: see link at very bottom of the page in this link http://www.lordemil.com/NWN/download.htm

C. I never used this method. PLTedit had some problems with plt icon creation especially and was very awkward to use in the garish bmp color system. If the plt editing you plan is very very simple (like changing eyes to tattoo 1 on a face plts or something equally trivial - there is a little simple plt program that edits stuff directly called plt edit http://nwvault.ign.com/View.php?view=other.Detail&id=407 which may work for you. Disadvantage is it only does really simple stuff and Advantage is you don't need any other plugins or paint programs.

Have Fun! Lisa

[edit] TXI

[edit] What is a .txi

A txi is a textfile that executes OpenGL commands on textures to achieve certain effects like the water animation or some spell effects. To make a txi working you simply have to name it the same as the texture you want to apply it to, only change the ending to .txi. (eg: abc01_water.tga/dds -> abc01_water.txi) .

[edit] TXI - Commands

The following is a list of commands you can use within a txi file. Most of this is taken from the Bioware txi document available with the Aura Export Scripts. You can comment out lines by using the # .

[edit] 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.

Specify a bumpmap

Default is no bumpmap.

bumpmaptexture mybumpmapname

Specify an environment map for static geometry.
Dynamic geometry uses the environment map provided on
the model.

Default is no environment map

envmaptexture myenvmapname

Specify a blending mode for a material. This blending
mode will override the standard mode:

Options are "additive", "punchthrough", "default"

Default is default.

blending default

[edit] 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.

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.

Defaultfor both values is 16

defaultwidth 16
defaultheight 16

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.

proceduretype arturo

Create a cycling procedural texture.
To create a cycling texture using "proceduretype cycle"
the texture will be cut in a number
of bitmaps defined by numx and numy.
The speed of a cycle procedure is controlled by "fps" .

default for both values is 1

numx 2
numy 2

Specify how the texture can be downsampled.

Default is a min of 0, max of 15

downsamplemax 2
downsamplemin 0

Specify whether or not to mipmap the texture.

Default mipmap is on.

mipmap 0

Specify whether or not 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

Specify the gamma correction for this filter.

Default gamma correction is 1.0

gamma 0.5

Specify whether or not 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

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

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

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

Adjust the sharpness of the textures alpha channel (??)
This feature is undocumented, but is used widely in Bio's txi files.
Value varies from 0.0 (blur) to 1.0 (sharp) .

default is unknown

alphamean 0.99

[edit] GENERAL TEXTURE CONTROLLER SPECIFIC FIELDS

These fields only apply to those textures
which are procedural. If these values are
specified on a non-procedural texture, they will
be ignored.

The following 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

The following field indicates whether or not to distort an
image using the procedure. 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.

distort 1

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

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

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

Set the speed of a (cycle type) procedural texture in frames-per-second.

default value is unknown

fps 4

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

[edit] Tips and Tricks

A good practice would be to ALWAYS work from a high-res 512x512 or 1024x1024 texture, then scale it down prior to releasing it. After all it's easier to lose information than try to create it from nothing when scaling up (reduces blurriness).

Also, when you convert a .TGA to a .DDS, it automatically compresses and creates multiple versions of the texture for either LOD (level of detail) or video card memory capacity. So that 512x512 .TGA sitting at 786kb (or 1mb with an alpha channel) usually compresses to ~300kb as a .DDS. And that .DDS contains the 512x512, 256x256, 128x128, 64x64, 32x32, and 16x16 versions, which would use up over 1.3mb otherwise.

So as you move your camera in and out, the engine will pick the appropriate resolution to apply to the model, so it doesn't stress the video card and CPU trying to scale the 512x512 texture on a model that's 5 pixels wide.

[edit] Tips from Texture Artists

[edit] BatInTheHat

"Plastic wrap is a nice quick way to slime up a texture. dupe your base layer, plastic wrap it with a fairly low smoothness and overlay on top. Also if you use plastic wrap on dirt then overlay it magically turns muddy."


[edit] Ryuujin

"A very VERY good technique is to use greyscale. Paint the whole thing in black and white so you're just painting the light and dark. Create a new layer, set it to "overlay" and then any colours you apply take up the background lighting so you effectivly "colour in" the object. So much easier than painting in colour."

"Packing ice works well for rough painted surfaces, or chitin - when you use "high pass" it forms a mixture of strong ridges, and lesser bumps (Then naturally you use "overlay" as it's render mode)."

"Don't use Paintshop Pro, unless it is the very VERY latest version, Older version cannot export Alpha Maps needed for transparencies and metallics."

"Never use MS Paint, no matter how much "teh l33t" j00 R... *cough* you are"

[edit] Tutorials

  • This flash movie shows how to create an alpha channel in a .tga : tga_alpha.swf

[edit] Random IRC Quotes

<NexusJnr> holy crap ray just taught me how to do something
<NexusJnr> it works :D
<NexusJnr> cheers ray
<Banter> np
<NexusJnr> now I must kill all people in channel


<Paganini> if you ever need some textures done, hit me up
<ThriKreen> nah, nexus is my whipping boy for that
<Paganini> cool
* RedR offers ThriKreen a brand new whip
<ThriKreen> OoOo +5 vs texture artists!


<batinthehat> oo cool, found a whole pile of old photos of magicians
<ThriKreen> er
<ThriKreen> I'm not going to ask.


<ThriKreen> Like is it "Done By Crayola(tm)" or "batinthehat/nexusjnr" quality? =)
<Dradjeel> who's nexusjnr?
<Dradjeel> and what has he textured?
<Soopaman> wait, Drad wasn't joking when he asked who NexusJnr was?


Main_Page | Textures

Personal tools