Back to tutorial index page

More patch manipulation, Lighting tips, Stairs and Ramps

In previous tutorials we have covered basic patch manipulation and touched on more advanced techniques. In this section we will look at more approaches to using patches. The merits and draw backs to using square cylinders (draw out a brush, with it highlighted, drop the curve menu, select more cylinders, then square cylinder) have been discussed previously. In fig.1 a square cylinder is being used to create a flying buttress style of support. A brush has been clipped at an angle to form the top of the buttress. The brush is a few units wider than the square cylinder we are going to manipulate. Create a square cylinder  and rotate using the tool bar buttons and move into roughly the correct position. Engage vertex mode (press v). Click on the verts (or drag a selcction box and select a groups of verts) you want to move and manipulate the cylinder into the position shown below. Make sure the cylinder is a little narrower than the support it ends in and the brush forming the top of the buttress. Don't worry about the cylinder entering the brush, that will not be seen in game. Press shift s to bring up the patch texturing inspector and hit natural to align the texture. Heavily manipulated patches can warp detailed textures, so it is generally better to keep the textures you select for your patches fairly simple.  

fig.1

Let's get more adventurous. We are going to create a hole. We could simply cut a square drop down to the level below. Details are everything though, so rather than a square or rectangular hole we are going to create a smooth rounded hole, with a rounded, smooth top (see fig.4) Firstly we need to create the hole. Remember verts need to meet verts, so the brushes need to be mitred in such away that the corners of the brushes meet the corner of where the bevel caps will be (see fig.2). Create a cylinder to fill the hole. Select the floor texture and cap the cylinder with bevel caps, move and clone so that the caps are in place, then align the cap textures. Now reselect the cylinder. Switch to yx (top down) view. Vertex edit to reduce the width of the cylinder by as many units as required. Now for the tricky bit. From side on view, move the top row of verts above the level of the floor then move the middle row of verts up to the floor level (a good map makers tip is to select the geometry you want to work with, hit Ctrl i to invert the selection, then h to hide selected. Now only the geometry you need to work on is visible, making working in detail far easier). In turn, now select each of the top verts and pull them out sideways so they sit level with the inside edge of the caps. Now select each on the middle row verts and pull them up, as shown in fig.3. Reselect the top verts and pull them down to the floor level, so they meet the caps perfectly (again, as shown in fig.3). When you've completed, don't forget to naturalise the texture.

fig.2

fig.3

fig.4

In several places around the level you may have noticed sharp, dramatic shadows being cast upon the surrounding geometry. Unlike newer games, Q3 has a static lightmap. Shadows are not cast in real time, they are pre-calculated during the compile of the level. If you run a level in devmap mode (type /devmap mymapname) then type /r_lightmap 1 at the console, you will see the level's lightmap. The geometry, apart from non-lightmapped shaders, will be white, with the shadows, light and colour burnt into it clearly visible. /r_lightmap 0 returns the map to normal. This lightmap is rendered onto the textures you apply to your geometry, so in a way, all textures in Q3 are blended shaders. Just because Q3 doesn't have dynamic (real time) lighting (how to fake dynamic lighting is covered later in this tutorial), doesn't mean that it can not rival the newest games in terms of realism and beauty. So how can sharp shadows be cast? The key is the use and positioning of your light sources, whether that be, shader or entity in origin. Try to shine light through interestingly shaped geometry, where it can be cast on to an appropriate surface. In fig.5 the area under the central archway is shown. I have placed a light ent inside the little lamp brush model I made, so that light is cast through the lamp, falling onto the curved arch ceiling. If you were to compile the map with the arrangement I described, the result would be disappointing. No crisp, clear shadows would be present. So how is it done? The final thing to do is to increase the resolution of the affected geometry's lightmap. Select the geometry, drop the entity menu. First select ungroup entity if patch groups are chosen, the select func_group. Bring up the entity editing window (press n) then add the key _lightmapscale, and a value less than 1. 0.125 is very Hi Res. Be aware that many Hi Res lightmaps will bump up the size of your .bsp considerably.

fig.5

A final word on shadows. Q3 isn't that good at rendering curved shadows or angled shadows. You can end up with ugly jagged shadows if the light is emitted from or hits geometry at certain angles. Changing light sources can help, also making affected geometry into func_group entities and assigning keys of _rc or _cs and a value of 0 is a useful trick. The _rc key prevents shadows being cast on to geometry, and _cs prevents it from casting shadows.

Let's return to more advanced patch work. In the base area ceiling I have constructed a dome with a patch of sky visible at the top (fig.6). It is those little details that perhaps most players wont even notice that set the look and feel of a level. Interesting ceiling work, just as interesting floor details are what sets a map apart from the crowd. So how is the dome created? Select your texture. It is important that texture is not detailed or busy, as some distortion is unavoidable.

fig.6

We are going to make a quarter of the dome at a time. Firstly create a bevel. Then naturalise the texture (fig.7). The dimensions of the bevel don't really matter. The important point is to keep things square. In the sample map the quarter section of the edited dome bevel is 184 units wide and long, and 104 units high. It's best to align textures now, as naturalising heavily vertex edited patches can really mess things up. Now bring up vertex edit mode.

fig.7

Vertex edit the bevel so that it looks like the image in fig.8 below.

fig.8

Next create a simple patch mesh textured in a contrasting texture. This can be vertex edited to fit around the bottom edge of the bevel, then naturalised.. In top down view, select the ceiling texture again and create a new bevel that follows the contour of the outer edge of the patch mesh. Now select cap/bevel cap. Keep one of the caps and delete the bevel and the other cap. If necessary move the cap into position, then align the cap texture. Your quarter dome section should now look like the image in fig.9. In the image below both the simple patch mesh and the bevel cap are selected.

fig.9

Nearly there. Now lets create a square cylinder, arrange it in such away that it sits with the top edge of our dome section halfway through it. Then vertex edit the cylinder to fit around the top of the bevel, as shown in fig.10 below. Naturalise the texture on the cylinder.

fig.10

Select the whole section and clone it (spacebar). Rotate the clone 90 degrees and position it next to the first section, so that verts meet up exactly. Select everything, clone again, rotate and move into position. Align textures as necessary, and we're finished. Your dome should look like the one depicted in fig.6.

Remember patches are not solid, that is they can not seal your map from the void. You will need to place caulk brushes on the outside of your dome to prevent leaks.

We have previously talked about how to create a jump pad, using trigger_push and target_position entities. Sometimes you might decide that actual stairs or ramps are called for, either because the height the player needs to scale is minimal, or for aesthetic or game play reasons. Normally stairs are 8 or 12 units high. Any thicker than 12 units are players will have to start jumping to climb, quite apart from the fact that the stairs will appear out of scale. Normally levels in a map are 128 or 256 units apart, this tends to be dictated by the size of the textures. In order for the stairs to correctly meet the level they are intended for, the height to be scaled must be divisible by the height of the stairs.

fig.11

Fig.11 above shows the correct construction of a small flight of stairs. Each stair is 8 units thick and 16 units across the top. Notice how the steps are clipped on an angle so that they sit perfectly on top of the wedge shaped brush beneath them that is not selected. Stairs should be made in this way in order to avoid over draw. All the unseen faces of the stairs have the common/caulk texture applied to them.

Some times you might decide that a ramp fits the style of your map, rather than using stairs. In the sample map there is a ramp leading from the base area to the cave area. In this case the height travelled is 192 units up and down whilst 336 units in a forward direction (fig.12)

fig.12

There are some draw backs to using ramps rather than stairs. Players using stairs give out sound cues to other players as they ascend or descend the steps, this doesn't happen with ramps. The other problem is that when stepping off a ramp players will experience 'ramp bounce', where they are bumped in an upwards direction just a little. The solution to both these problems is to create some invisible steps out of player clip (fig.13). The common/clip textures block the player or bots, or both. Clip is used to smooth the player's passage through the world so that they do not become snagged on geometry. Clip can also be used to prevent players or bots from reaching areas you don't want them to get to. Further details on the use of clips will be covered in a further tutorial section. Each of the clip stairs are 8 units high and 12 units across the top. The stairs will be invisible in-game, and the ramp will appear as a normal ramp.

fig.13

A quick word on the remaining geometry around the ramp. The curved ceiling is an endcap, vertex edited to follow the angle of the ramp (fig.14). The endcap sits on top of two brushes, again cut on the same angle as the ramp. The brushes are 64 units in height at the top and bottom of the ramp (fig.15).

fig.14

fig.15

Square edges can be boring. So the inside edge of the brushes have been angled downwards. Whilst clipping the brush into this shape would be possible, there is an easier way to achieve this effect. Select one brush and hit v to bring up vertex editing mode. Carefully click on the top inside corner vertex of the brush and it will turn blue (fig.16). Sometimes it is actually easier to select an individual vert in the 3d window, although caution should be used when doing this as it is easy to lose control of the direction things get moved in. Back in the 2d window carefully drag down the vert 8 units. Keep an eye on the 3d window to check you have moved the corner in the correct direction. It is possible to move verts around in the 3d window, but again very great care is needed. Select the corner vert at the bottom of the brush and drag that down 8 units as well. After vertex editing brushes go to plugins on the tool bar, then Bob's toolz, then select brush clean up. This will repair any brushes damaged by vertex editing, as can sometimes happen.

fig.16

Feel like being creative? How about some spiral stairs? See fig. 17 below (note the stairs are blue in the 2d window, this is because I made them into a func_group entity for ease of moving about).  In the base room there are two flights of spiral stairs, one ascending each side of the room. These stairs are open, but they could very easily have been enclosed in round tower or such like.

fig.17

So how do we set about creating a spiral stair case? First we need a template or guide to assist in the clipping of brushes. A bevel is created to act as a guide. The dimension of the bevel depend very much on the size of the stair case you want to create. The stairs in the sample map are actually 2 groups, each 128 units square and rising 80 units. The bevel created was, therefore, 128 units square (fig.18). It was necessary for the stairs to rise 80 units, each step was 8 units high, meaning there needed to be 10 steps within the 128 unit square. At the wide end, therefore, each step would be roughly (although not exactly) 12 units in width. An exactly matching  width for each step at the wide end does not matter as 1 or 2 unit difference will not be noticed in game. The important points are to keep the stairs a consistent height and within the 128 unit square.

fig.18

Now we are ready to make the first step. Draw out an 8 unit high brush, 12 units deep, that sits on the floor. Drop the grid to 2 and zoom in (mouse wheel, or use insert/delete). You are going to clip the first step so that it approximates the step shown in fig.19. The edge of the first step will not require clipping, but clip the back edge from the back, outside edge, to the inner aspect of the stair case, as shown. Draw out another brush. Clip the outer edge so that one side meets the out side of the bottom step, and the other side follows fairly closely the line of the bevel. Check the step at its widest point is still roughly 12 units wide, then clip the step on an angle to the inner aspect of the stair case.

fig.19

Now we have to move the step into position, change the 2d view and raise the new step up so that it's bottom edge meets the top of the lower step, as shown in figs. 20 and 21.

fig.20

fig.21

Now you have to repeat the process for each of the remaining 8 steps. Then delete the guiding bevel. Texture the steps as required. I turned my steps into a func_group and cloned the steps, the repositioned them so as to form a single flight of steps rising 160 units and turning 180 degrees. In the sample map I placed a cylinder as a central column for the spiral stair case to rotate around, adding a sense of solidity and realism, rather than leaving the stairs floating in space. The cylinder is placed so that the inner aspects of the stairs are very slightly inside, again, in-game, no z-fighting will be seen, so this causes us no real problem. As with all internal geometry the stairs are made into detail brushes, as they play no part at all in controlling vis.