Alpha Channels & Texture Tutorials
Come here for tutorials and 3d training. The aim is to point out good 3d training sites or methods.

Moderators: Winterhawk99, Mermut, Bannor Bloodfist

Guest

Alpha Channels & Texture Tutorials

Post by Guest »

This topic could go many ways. I am approaching the creation of textures mainly based off of Martin's web tutorial (never know how long these will stay up).
Martin E. wrote: This is a series of occasional tutorials for using Photoshop in the creation of textures for Neverwinter Nights Custom Content. They assume a basic knowledge of how Photoshop works, mainly in the use of layers, setting the image size and basic editing functions. The tutorials are best used as a source for various techniques that can be used to create, improve and alter textures for use in Neverwinter Nights. Although the tutorials are specifically written for Adobe's Photoshop, many of the principles and techniques should be the same for other packages, even if the methods may vary.

I really wasn't sure how to pitch these tutorials, so some may focus a bit too much on the basics, whilst others will deal with the more advanced features of photoshop. I'm hoping that even experienced users will find something of use, even if it's only a new avenue to explore.

Also I'm sure other people have different, and probably better, ways of doing things, so please make any suggestions for tips and alterantive methods especially if you think my methods can be improved on.

The following is a list of the tutorials currently available, with future content greyed out. These will be added when available. If anyone has any suggestions for other topics please let me know and I'll see if I can cover them.

Guest

Post by Guest »

Tutorial 1 - The Basics: Texture Types, Sizes and the Essential Tools

NWN uses textures mapped on to 3d game objects to give them their appearance. These textures are mapped onto the objects via various 3d packages such as 3d Studio. The mapping process itself is dealt with in a later tutorial, but the focus of most of the tutorials here is the actual texture images themselves, and how best to create and improve them.

This tutorial is aimed more at the textures used for placeables and tiles rather than PC characters which use a different image format altogether - PLT files.


Image Size and File Types

It's best to use a simple 512 x 512 pixel image as the base for most of the texures fro NWN. These can then be reduced to suit the use of each texture in the game. In most cases a 256 x 256 texture is sufficient, but working from a 512 x 512 base gives you the option to reduce it later on rather than restrict yourself to 256 from the start. In fact a lot of the time I work on a texture at 1024 x 1024 and reduce it once I have finalised it. The final texture needs to be in one of 2 formats, either a TGA (Targa) file, a simple uncompressed image file, saved as either 24 bit or 32 bit (but we'll get to that later) or a compressed format aimed specifically at more recent graphics cards called a DDS file. The DDS file still needs the TGA file as a base, so textures are normally saved in the TGA format.

Not all PCs will be able to use the DDS texture, so whenever you are packaging your textures for a HAK, you should always include a back-up of a TGA (at a smaller size, say 256x256 or 128x128).

The DDS file basically consists of different sized versions of the same image, 512x512, 256x256, 128x128, 64x64, 32x32, 16x16 etc. that the video card can use depending on how much detail is needed. There are a couple of tools out there that can be used to convert your 512x512 textures to and from DDS format, but these will be dealt with in a later tutorial. You will always need the basic 512x512 TGA as your starting point anyway, so this is where most of the tutorials start.


Where Can I find the Game's Standard Textures?

It depends which textures you are looking for. For tilesets the main files are kept in a BIF file which should be in /NWN/data/bifs and are typically called aurora_ttr.bif (rural set) the 3 letter suffix changes depending on the tileset.

As well as all the models the Bifs contain a low resolution version of the textures as a TGA, typically sized at 128 x 128 pixels, although some are smaller.

The larger 'original' textures are actually stored in an ERF file: /NWN/texturepacks/Tiles_tpa.erf for tiles, or /NWN/texturepacks/textures_tpa.erf for creatures and NPC parts. These are in DDS format and will need to be extracted before work can be done on them. Because you can't easily view a DDS file, it's normally easier to search the tileset's BIF file, find the texture you are after and make a note of it's name before seeking out the DDS file.

Textures for player characters use a different format: PLT and can be found in the BIF file: NWN/data/textures_02.bif. The tutorials here don't cover PLT files. For these check out the information on Biowares site here.


Essential Tools

As well as an image editing package such as Photoshop, you will need one of the following for extracting and adding textures to the Game's various files: To extract, view and add textures to the various game files (HAKs, BIFs etc.) You will need Zoligato's great NWN-Viewer application available on the NWN vault, or Torlack's NWN Explorer, again available on the vault. Instructions and tutorials for using these and other NWN tools can be found in Eligio Sacateca's essential Custom Content Guide.

To package DDS textures you will need both the following tools:

DDStools.exe is used to unpack the various sized TGAs from a DDS file - You will need to use this to extract TGAs from the games' standard texture DDS files. I'm not sure who wrote this utility so I can't credit them. If anyone knows please drop me a line and I'll add it here. This is a DOS utility and instructions can be seen in Eligio's custom content guide.

To compile a DDS file from a base TGA you will need to use Bioware's DDS Compression utility, also available on Bioware's site. There is a brief tutorial on using this tool on Bioware's site here.

DDS files are useful to get the most out of more recent graphics cards, and for improving perfomance and reducing the overal size of texture files.

Guest

Post by Guest »

Tutorial 2 - How Big Should My Textures Be - Surely Bigger is Better ?

Warning: The images on this page are uncompressed and may take some time to download, mainly because I have kept the quality high for comparison reasons.

This is a very subjective issue in NWN, and different people will give you a different answer.

The starting point for most textures is a 512 x 512 TGA file, and for the purposes of working on a texture I wouldn't go any smaller. However for packaging it up for the game there is an argument for reducing it's size.

TGA files are not compressed. A 512 x 512 image will therefore have a file size of 768k. Even in its compressed DDS format it's still 171k. It doesn't take long for textures to clog up the memory and start affecting the game's performance.

A further complication is the addition of Alpha textures (the subject of later tutorials). These are used when part of a texture needs to be transparent requiring additional information to be stored in the file. A 512 x 512 alpha texure saved as a TGA has a file size of 1,025k (1MB).

Saving all textures as 512x512 TGAs will cause a severe performance hit for NWN, especially in texture intensive areas.

The following is a guide on the files sizes for various texture sizes and types:

Texture Size 24/32 bit* File Type File Size 512x512 32 bit TGA 1,025k 512x512 32 bit DDS 342k 512x512 24 bit TGA 768k 512x512 24 bit DDS 171k 256x256 32 bit TGA 257k 256x256 32 bit DDS 86k 256x256 24 bit TGA 193k 256x256 24 bit DDS 43k 128x128 32 bit TGA 65k 128x128 32 bit DDS 22k 128x128 24 bit TGA 49k 128x128 24 bit DDS 11k * 24 bit is a standard colour texture with 3 channels; Red, Green & Blue (8 bits each)
32 bit is for a colour texture plus an alpha channel; Red, Green, Blue & Alpha (8 bits each)
the 32 bit alpha channel is needed to store transparency information for a texture (ie the tree canopies) where black and white infromation in the alpha channel tells the game what is transparent (black) and what is obscure (white) There is a big difference in file sizes through the different texture sizes. Within the TGA, halving the resolution (512 pixels to 256 pixels in a linear direction) quarters the file size (1025k to 257k). This will have a significant benefit to the performance of the game both in real time via the graphics engine, and in load times as smaller files are required.

So what is the loss in quality from dropping from a 512x512 texture to a 256x256 sized one ?

This depends on the size that the texture is used in the game. If the texture is mapped onto a large object that can be seen close up there may be a very visible decline in quality. In most cases though a texture isn't mapped that large, and there is very little drop in quality.

The following screenshots demonstrate the affect in game of changing textures. Screenshots are taken at screen resolution 1024x768 and are exported from Photoshop as jpegs with quality set to 10.

Gameshot showing location of detail

Image

Original 512x512 TGA [File Size 769KB (24Bit) or 1025KB (32Bit)]
Image

512x512 DDS [DDS File Size 171KB (24Bit) or 342KB (32Bit)]
Image

256x256 DDS [DDS File Size 43KB (24Bit) or 86KB (32Bit)]
Image

There appears to be no appreciable loss in quality from the base 512x512 TGA to the 512x512 DDS compressed version, and a minimal loss in definition in stepping down to the 256x256 sized texture. The only loss in quality manifests as a slight bluriness.

For these particular screenshots the main stone texture was mapped with a UVW map setting of 200x200x200. The texture is spread over an area equivalent to a standard door width in NWN. The texture could be spread over a larger area if needed, but the qulaity will begin to deteriorate.

Of course you can't use a general rule for texture sizes, it depends on how large an area the textures are sized to fit over in the UVW mapping - I tend to use a maximum of 400 x 400 x 400 box if I can help it (I have gone larger than this though). But I have satisfied myself that I can use 256x256 DDS without too much loss in quality so long as I keep the mapping sizes reasonable, and gain a significant improvement in performance resulting from files sizes that are reduced by 75 to 80%.

This also has the added advantage of reducing HAK sizes as texture are by far the biggest contributor to those inflated download file sizes.

Conclusion

256x256 sized textures can be used fairly extensively in NWN with only a slight loss in visual quality, and big gains in performance. When sizing a texture, consideration must be given to the mapping scale, in some cases a 512x512 texture may be necessary, particularly if it is spread over large area, such as the whole of tower wall, or for a large floor feature, but on the whole where textures are tiled, 256x256 is more than adequate. In some cases where textures are very repetative, such as floors, texture can be reduced further to 128x128 or even 64x64. It all depends on the size of the mapping.

Guest

Post by Guest »

Had to break this one up into 3 parts to fit boards limitations

Tutorial 3 Creating a Stone Texture From Scratch (Using Layers and Render Clouds)

This is a quick tutorial to run through a some of the most useful functions in Photoshop to help in the creation of textures from scratch, or for adding some much needed variety and detail to other textures. It's aim is to explore some of the more fundamental tools that Photoshop has to offer.

I wasn't sure what level to pitch this tutorial at as it does deal with some basic / fundamental principles for Photoshop, so if anything it may be a bit on the simplistic side and it describes some processes from the 'where's that tool?' standpoint.

As I mentioned in Tutorial 2, although texture sizes in NWN should be no larger than 512x512, I often work on a texture at a larger size, such as 1024x1024 and reduce it to 512x512 once completed.

Start by creating a new RGB colour, 1024x1024 (or 512x512) sized canvas. File_New and select the size and RGB file type.

Image
The first step is to fill the image with a texture which you can use as a base to create your new one. To do this I use Render_Clouds, for me, one of the most used and most useful filters in Photoshop, as not only does it fill the canvas, but the pattern is also fully seamless. Select Black as your foreground colour and white as the background colour, then go to Filters_Render_Clouds, and you should get something like this.

Image
Having filled the canvas, the random clouds can be used to create a more stone like texture by adding another filter affect. This time use Filter_Stylize_emboss which will bring up another dialogue box. Using this you can set the direction that the light is coming from, the height and the amount of the emboss. I used height 5, and amount 500%, but you can play around with it until you create the stone affect you're after.

Image
Next tool up is the levels adjuster. This is one of the most useful image adjustment tools in photoshop as it allows you to alter the overall brightness / contrast of the image with far more control than the more general brightness / contrast tools. The tool itself can be found under Image_Adjust_Levels and will bring this dialogue box up. The graph represents the total number of pixels in the image at different brightnesses from black on the left hand side, to white on the right. There are 3 sliders along the bottom that can be moved around. To affect just the lighter parts, slide A to the left - this is called the white point, and moving it into the pixel graph shifts the lighter greys to whites. Slider B does the same with the darker greys, sliding it to the right shifts darker greys to black. the centre slider C is used to shift the mid-tones. Levels can be used to set just the right balance between brightness and contrast.

continue onto part II of IV posts of this topic.

Guest

Post by Guest »

Part II of topic continued

Image
This is the image after a subtle tweak with Levels. As there is no colour, the next step is to add some colour texture to the image. Rather than adding colour directly into the same layer as the base texture, it is better to create a new layer and add the colour to that.

Layers are an essential part of photoshop if you want to unlock the potential of many of the tools. The basic principle is that you can layer affects and images to build up a texture, but keep the various elements separate so that they are far easier to tweak independantly from the rest of the image.

To add a new layer, go to Layer_New_Layer and type a new name, or leave it as the default layer 1.

Once you have added the new layer, make sure you are editing that layer rather than the background. Check the layers window - with default setting this is normally located in the bottom right hand corner. If it's not on the screen you can switch it on again under Window_Show Layers. There is an eye symbol to tell you which layers are switched on, and a paintbrush icon to highlight the layer that you are currently editing. Select the top layer - The one you just created.

Image
To add some colour with a bit of variation I tend to use the render clouds tool again, this time by using 2 colours rather than black and white. Choose a couple of colours that compliment each other, or that would represent a particluar type of stone. Once you are happy with the colour selctions in the foreground / background colours, go to Filter_Render_Clouds. This will fill your new layer with coloured clouds as shown here. Obviously this now obscures the base texture below. The technique I use for 'mixing' the two textures is to change the properties of the top one to multiply. This makes the white parts of the layer transparent, whilst the darker areas keep their colour. It's a better technique than changing a layers opacity which can cause colours to become washed out. To change the layer type to multiply you can either double click the layer in the layer window to bring up the layer properties box and change the layer type in the drop down menu, or use the drop down menu in the layer window itself - again making sure that the right layer is highlighted first.

Image
Once you have set the top layer type to multiply you should see something like this, with the two textures 'mixed together'. The colours here are a bit too strong for stone and need to be toned down a bit. The best tool for this sort of colour manipulation is the Hue/Saturation tool. With the top layer selected, go to Image_Adjust_Hue/Saturation which will bring up the dialogue box shown in the next step.

continue onto part III of IV posts of this topic.

Guest

Post by Guest »

part III of topic continued.

Image
There Hue/Saturation tool has 3 sliders, the top one Hue can be moved to alter the overall colours in the layer. The second Saturation can be used to intensify or desaturate the colours, and the bottom slider affects the brighness. The best way to use this tool is just to experiment and see what colour shifts can be created.

Image
In this case, I was trying to tone the colours down a bit, so I reduced the Saturation, and pushed the Hue to the right a few steps to add a bit of green. Finally I increased the Brightness slightly to weaken the overall colouring on the texture.

The texture colouring and brightness is now reasonable, but seems a bit too blurry, mainly because of the stone texture in the background layer.

Image
Photoshop has a few different sharpening tools, and there are plenty of other techniques to get more selective sharpening. For this tutorial I use Unsharp_Mask which sounds like a bit of a misnomer, but provides some control over how the image is sharpened. As the bluriness is in the background layer, firstly make sure you have that layer selected - check the layer window and highlight it if necessary. Go to Filter_Sharpen_Unsharp Mask which will pull up this dialogue box. There are 3 main attributes that can be set, again experimentation is the best way to to see how each of them affects the image. The best way to use the tool is to keep the affects subtle, particularly by keeping the radius settings low. The settings I used were:

Amount 180%, Radius 2, Threshold 0.

Amount is self explanatory, whilst radius affects the area which Photoshop references in the image to compare and sharpen - too high and you get 'clumping' and too much contrast. Threshold is the level of contrast above which Photoshop will sharpen - setting this to 0 sharpens the whole image.

continue onto part IV of IV posts of this topic.

Guest

Post by Guest »

Graphic intensive had to break this up into parts.

Tutorial 4 Adding More Detail (adding multiple layers to weather / dirty a base texture)

This tutorial focuses on the techniques to help build up a more detailed texture than the previous example. It takes the stone texture that the last tutorial finished with and adds some stonework coursing and some weathering.

The stonework coursing texture that I use in this tutorial was downloaded from The 3d Studio, a great resource for free and commercial textures, as well as tutorials on modelling techniques and a whole host of other resources. The texture is used and reproduced here with the kind permission of it's creator, Matt Anderson. The texture is in the bricks category, but you will have to navigate to it yourself. It's actually the greyscale bump-map texture for a brick texture.

Image
This was the base stone texture that was created in tutorial 3.

Image
This is Matt Anderson's stone coursing texture that I downloaded from The 3d Studio (thanks again Matt), it's under bricks in the texture sections. After resizing the brick coursing to suit, it can be added as a new layer to the stone base. The easiest way (Assuming they are the same size - is to open the stone coursing, Select_All, Edit_Copy, switch to the stone base, and Edit_Paste which will add it as a new layer).

The layer type will have to be set to multiply so as to blend with the stone.

Image
This result may be a bit too dark, mainly because the stone coursing has a lot of grey in it rather than white. To correct this, use the Image_Adjust_Levels tool to lighten the lighter greys to white.

Part I of iV please continue

Guest

Post by Guest »

Part II continued

Image
The overall texture looks a bit flat, without much in the way of natural looking highlights. To add a bit more natural light to the texture you can add another layer. Fill this new layer with Render_Clouds again with Foreground set to Black and background to White. Instead of setting the layer type to Multiply, set it to Colour Dodge. This will have the effect of 'bleaching' the area below the white areas of the new layer, whilst leaving the black areas as they were. The initial affect will be very strong, but you can weaken this by reducing the new Colour Dodge layer's opacity (in my example to around 50%). The result should be similar to that shown left.

Image
The next step is to add some moss like green staining to the stonework to look like a damp weathered wall. Create a new top layer and use Render_Clouds, this time with Green and White set as the foreground and background colours. As an aside here, I tend to use 1024x1024 as my working size for textures (as left), even if they will be reduced to 256x256. The Render_Clouds tool fills the canvas with random clouds. These clouds are scaled to the canvas size, so a larger canvas will provide more variation in the clouds, whereas a smaller canvas such as 256x256 provides much less variation. The more variation in the texture the better as the patterns won't be as obvious when tiled.

Image
Set the new layer's type as Colour Burn. Colour burn uses the burn layer's colour to darken the colour below - white has no affect. This creates the green overlay shown here. If you want to weaken the green you can either reduce the layer's opacity, or use the Levels adjustment to increase the amount of white (therefore decreasing the amount of green).

Image
With the finished texture you can save it as a TGA file which will flatten all the layers. Open the new TGA file file, and resize it with Image_Image Sizeat the desired size (probably 512x512).

You can then test the 'tiling' of the texture by using Select_All, and Edit_Define Pattern. Create a new file with a canvase size of at least double the size of the texture, then use Edit_Fill which will tile your texture over the new area. For the example here I used a 2048x2048 canvas which will mean the texture will get tiled as a 4 x 4 grid.

These techniques provide a fully workable stone texture complete with weathering and block coursing. Using the Render Clouds and Matt's stone texture, the image is also 'seamless' with no joints when tiled.

Contine to part II of IV

Guest

Post by Guest »

Part III continued

Tile Patterning & Texture Scale

Although the overall texture is workable, in that it looks like stone and is seamless, When tiled, the weathering affects have contributed to a 'patterning' affect which accentuates and emphasises individual tiles, and doesn't look too convincing. Also the stone coursing texture used here has a particular scale to it, meaning that it is difficult to use the overall image without tiling it to quite a high degree. In other words, if you were using this texture on a tower wall for example, the texture would need to repeat over large areas causing the tiling affect to be quite obvious.

The key to reducing the impact of this tiling is to size the texture appropriately for it's intended use. Taking the tower as an example again. I know that the stone blocks will dictate how large I can map the texture, so if I want to map the texture at a larger size (thereby reducing the number of tiles over the tower wall) I will need more smaller blocks on my 512x512 texture.

By scaling the texture to suit in this way, you can also scale the weathering affects over larger areas to reduce the impact of patterning on the final model.

The following steps show how to resize the blocks from the previous texture to reduce it's scale.

Image
To rescale the stone coursing, reopen the original texture image and resize it to 1/4 of the size of the working stone version above (ie 128x128 if you are using 512x512). Use Select_All, Edit_Define Pattern. Create a new layer immediately above stone coursing layer you created at the beginning of this tutorial (which you should switch off). With this new layer selected use Edit_Fill. This will create a 4 x 4 grid using the stone coursing to replace the previous version. You will need to set the layer properties of this new layer to Multiply to get the combination affect back. The new stone coursing is shown here with the other layers also turned on.

If you compare this texture to the tiled version above there is more variation, and less 'patterning' visible.

The downside of this however, is that the texture will have to be stretched over a larger area on a model now because the stone blocks will dictate what looks realistic in terms of size.

Image
Another way of weathering the texture is to add a darker stained base along the bottom which will help to sit a building on the ground and make it look more a part of the landscape. This is easily done using another layer. Create a new top layer, select it, then pick Black as your foreground colour, and White as your background colour.

You will need to use the Gradient tool next Image The gradient too will fill an area starting with your foreground colour at your start point, and shade the fill to the the end point you select to the background colour. You will need to pick the first point and drag the mouse to the second point. A quick tip, after you have picked the first point, if you hold Shift down, the second point will be restricted to either the x or y axes, or a 45 degree angle.

Image
The Gradient Fill Should look something like this. Change the layer type to Multiply and you should see a dark to light gradient over the top of the base texture. It will probably be a bit too dark, so changing the layer's Opacity will reduce the impact and make it more natural looking (I used 60% for the example below).

Continue onto part IV

Post Reply