User Tools

Site Tools


Making Object Roofs


The Dark Engine is much more forgiving when rendering complex objects than it is with complex terrain.

Of course objects aren’t (always) as good with collision and lighting as terrain, so you are limited in what you can build. An example of a terrain-like feature that could be made from an object is a pointed rooftop. These are rarely accessed by the player/AI and tend to be illuminated by few (if any) light sources.

This tutorial will describe how to use an object editing program to make a rooftop, and in particular, how to map the texture(s) so that it looks like a terrain feature. This tutorial will not tell you how to use your object program because there are so many to choose from, and there are often several ways to do things.

First you’ll need a building from which to work out the dimensions. In this tutorial the roof will be made for a building that is 48×32. I will mention other dimensions, but they are only used as examples. When you make your own roofs, if it looks good, it’s probably correct.

Making the model

Start your object editing program and create a cuboid that is 50×34. This will allow the roof to overhang the building by 1 unit all the way round, and can help prevent your buildings having a ‘just a cuboid’ look to them. Make it 1 or 2 units high. Copy this and change its height to something like 20, then position it so that it is stacked on top of the smaller cuboid. At some point you should also delete the top face of the smaller one, and the bottom face of the larger one, because it’s good practice to avoid having faces that can never be seen by the player.

Next you need to drag top points of the upper cuboid towards the centre of the object so that they either form a single point like a pyramid, or a line like a… rooftop. You’ll now have several points in the exact same place, so merge each group, weld them, or whatever the process is called in your object program.

Two examples: Note how then end-faces of the second roof have a slight slope

Of course you can make them more complex than this. You could add a chimney, or some windows sticking out, with their own pointed roofs etc, but you do need to start somewhere.

Applying textures

The player may notice if the texture on an object is stretched over too large or too small an area, so you need to map it in a similar way to which terrain textures are mapped. I.e. at right angles to the X, Y and Z axes, and with the tile width or height being 1 unit long for each 16 pixels of the texture width or height. It is quite acceptable to scale the texture up or down from this ‘default’ scale, it depends on how far from the object the player is likely to be when they can see it, and the scale of the textures on the surrounding terrain. This tutorial will assume you’re trying to match the default scale with a texture of 128×128.

Create a cube that is 8x8x8 roughly in the centre of the object. Apply the texture to the ‘front’ and ‘back’ faces of the object (not the sides, they’ll be done later).

Texture applied to object. Notice that there is something wrong with the mapping. This is because of the way the top points were dragged around and merged.

Now you need to sort out the UV mapping. View the textured faces so that you are looking directly at one of the faces of the cuboid you created. Activate the UV mapping controls and switch to a wireframe view. Shrink the texture so that it is equal in size to the cuboid:

The texture on the back will actually be the wrong way round, but few people will notice. You also need to map the texture in this way on the ‘side’ faces. You may need to ‘detach’ the side faces so that they form a separate mesh. The same goes for the texture on the underside.

For the underside, you should try to find a texture that’s quite plain. Try not to use one that looks like wood because that could give the player the false impression that they could use a rope arrow to climb up.

When you load the roof in Dromed, you may find that the bottom face is lit strangely. If so, try cutting a hole in the bottom face that is the same size as the building. Object faces are lit either by the brightness of their corners or the brightness of their centre, depending on what options you select when you convert it. If the underside is just one big face, the corners will be very far from each other, and the centre will be on top of the building.

Feel free to add protruding windows with their own pointed roofs, a chimney or two etc to make it look better. And feel free to take advantage of the increased complexity that objects are allowed compared to terrain.

dromed/objectroofs.txt · Last modified: 2008/09/20 16:11 by r_soul