page 1 || page 2 || page 3 || page 4 
 Textures

 Textures: introduction

Unlike more recent games which use tile sizes which are multiples of two, example: 16, 32, 64, 128, 512, 1024,
Duke Nukem 3D textures are various sizes. This makes it difficult when selecting tiles for Duke3D.
Not that it makes it difficult, really, but it does limit you on what tiles you can use with any success, that is, tiles that will work with what you are tiling. This is why, throughout various tutorials, we have mentioned ceiling heights, the width/length of rooms, and using particular grid sizes. Now, we're going to delve deeper in to the reasons for keeping those things in mind.

 Textures: grid size  < g >

Although Duke3D tiles are mostly various sizes, the common floor, ceiling, wall, and door tiles are of dimensions like more recent games, in that, they are sizes 32 x 32, 32 x 64, 64 x 64, 64 x 128, and 128 x 128.
See? Good ol' Build isn't that dinosaurian.
Anyway, keeping in mind that you can change the grid size you're working with at any time (even in the middle of copying and moving sectors) is of great use.

The largest grid size is 64 x 64 and four of these makes up an area which would accommodate a 128 x 128 floor tile. That is, a 128 x 128 would line up perfectly within this grid size. Therefore, if you are going to use say, tile # 181, then you might work with the largest grid size and perhaps make a room or an area using one, two, or more of these 4 x 4 units. Those units would be comprised of four of the largest grid squares.

Let's say that you start with a fresh map and make one sector the size of four of the largest grid squares.
You would be able to use, without overlap or run off, either sixteen 32 x 32, four 64 x 64, or one 128 x 128 sized tiles for either the floor or the ceiling. The grid size is related to tile size. This is a good place to mention the expansion key. You can change the scale of a floor or ceiling tile by pressing the e key on the texture in 3D mode. Each time you press the e key on the texture in 3D mode, you alter the scale of that texture by 50%.
You cannot make a texture bigger than it already is but you can half it or make it full size by using this method in 3D mode. An example, again using tile # 181: using an area the size of four of the largest grid squares, a 128 x 128 tile would fit perfect, (full size) within this sector. Pressing the e key on the texture in 3D mode would scale the texture down by half as if it were a 64 x 64 tile and hence, you would be able to fit four of these tiles within a sector of this size.

 Textures: default ceiling height / the default cube...

Use the largest grid size and try this: starting with a fresh map, make a sector the size of one grid square. Don't raise the ceiling or change anything about the dimensions of this sector. I'm going to use this as an example and we're going to call this the "Default Cube".

The default cube has a ceiling height of 16 units (or 16u as I might refer to it from here on in).
What I mean by one unit is the height of one press of the page up or page down key. 16 units or 16u would be the height of pressing the pg up or pg dn key 16 times. In any case, 16u is the default height when one starts a brand new sector in a fresh map. If you look through the original maps you will find that many of the doors are 16 units in height. Most ceilings are somewhat higher than this but then it depends on what you are creating. The point is, a 64 x 64 texture will fit on any one of the surfaces of this default cube.

 Textures: example tiles using the default cube :

We're going to apply various textures which are multiples of 16. For instance, apply tile # 325 (64 x 64) to three of the walls, door tile # 450 (128 x 128) to one wall, ceiling tile # 326 (64 x 64) to the ceiling, and on the floor apply tile # 181 (128 x 128). This room, as cramped as it is, isn't very pretty either but it's prefect for the next bit of information about choosing and applying textures.

Notice how the wall tiles fit perfect on each of the three walls we applied it to. Also notice that only ¼ of the door tile fits on the wall we applied it to and, depending if you had hit the e key on the ceiling or floor, that the tile we applied to the ceiling fits perfectly, tiled only once and the floor tile is also only showing ¼ of its full image. I did this to illustrate the relationship between tile size and grid size .

If we press the e key on the ceiling, it will be halved by 50% and the texture will tile four times, that is, the texture now tiles four times because it is now, as if it were a 32 x 32 texture. We painted tile # 181 on the floor and it will not fit in this grid size (64 x 64) without using the e key on it in 3D mode. Press the e key on it and it is halved by 50% and tiles only once being that it is actually four times larger than a 64 x 64 grid square.
Get the idea? Now, we'll talk about the door tile we used in this default cube.

We used the door tile # 450 and I purposely chose this one because it is much larger than the cube we have been using in this default cube example. I want to make a point about the relationship between ceiling height, grid size, and tile dimensions which will, eventually, lead us to talking about alignment and panning in the subsequent tutorials on textures. Back to our default cube...

We see that painting the tile # 450 on one of the walls of this cube does not fit the dimensions of the wall we painted it on. By panning the texture using the 6 key (on the keypad, not the one above the alpha keys; we use the keypad keys for panning) will pan it so that it fits horizontally. Using the the 2 key on this door tile will pan the texture so that it fits on this surface, vertically. Take note that this 128 x 128 now fits perfectly on this wall which is the equivalent of 64 x 64.

 Textures: the point of all of this :

There is a direct relationship between the default ceiling height, the size of the grid square, and the dimensions of a texture. You should now understand the grid size relationship so I am going to talk a little more about ceiling height and texture size.


 Textures: ceiling height and tile size :

The default ceiling height is equivalent to the height of a 64 x 64 texture. The default height is 16 units or pressing the page up key 16 times in 3D mode. Hence, we know that each unit or one press of the pg up key is the equivalent of four pixels (in relation to the tile which is in pixels). That is why in previous sections, of the various tutorials found here at JS Build, I have mentioned using an equal number of units for ceiling heights. It is much easier to pan textures in units divisible by two and even easier, although not always what one may want, to pan or tile textures within ceiling heights of  8, 16, 24, 32, 40, 48, 56, 64, etc.
Notice that all the numbers we're throwing around here, are numbers that the tiles can be divided by with a resultant, even number.         point: Use ceiling heights divisible by two.
 Textures: ...and finally, back to the door tile we used in the default cube example :

The door tile was # 450, a 128 x 128 texture. I don't believe that most wall and door tiles were made 128 x 128 so that ceiling heights should be 32 units. On the contrary, well, kind of...
Have you ever noticed that scaling tiles down, opposed to up, that they look better than scaling them over their actual size? I'm sure that you have. If you look through the original maps you will notice that most doors are 16 units in height. The door tiles, most of them, are 128 x 128. However, a 128 x 128 tile can be panned nicely to fit a wall with the height of 16 units (the equivalent of 64 pixels). My guess about the wall and door tiles being 128 x 128 is because they scale nicely downward and if you need a higher ceiling or a larger door, the texture won't look bad. A texture that has been panned larger than its actual size looks terrible but a texture panned smaller looks fine and the result is totally acceptable.