Hints, tips and tutorials for 3D modelling & content creation
|
KatsBits
Creating 3D models, meshes &
game content
3D modelling & meshing, level editing and textures makingHints, tips and tutorials for 3D modelling & content creation [back]How to.. Converting maps into modelsResources
Contents
What's this all about? ^The use of models is normally because certain objects are too complex to create using brushwork or patch meshes, they do however serve additional purposes;
In other words, sometimes using brushes just doesn't look right so you need to find a way to represent what you're trying to do using other means; this is where models come into play. 'Notes' to note ^Before going any further one important note to keep in mind; The position of brushwork relative to the editors (Radiant and GTK Ratiant) 0,0,0 grid centre is important, this will eventually be the 'Point Of Origin' ('POO') for the model, around which the object is rotated and manipulated in both Radiant and which ever 3D modelling application is used to edit the mesh. It's essential to keep this in mind before exporting/converting the brushwork as per below. There are a number of 'technical' reasons for this (see next sub headings for further details on each 'reason');
Structural brushwork and 'breaking' models ^Models and entities 'break' if their point of origin is buried in structure brushwork (brushes that are seen as being 'solid' by the compile process - they seal the map from the void) which results in the map returning a 'leak' error during the compile process. This means that when prepping brushwork for conversion you need to over compensate for the relative position of the POO against it's eventual use as a model when it's brought back in to the editor. The brushwork platform shown in the images below has been aligned to GTK Radiants 0,0,0 grid centre to allow plenty of room for the support struts to be buried deep into brushwork without blocking or otherwise interfering with the models point of origin; as an example, a rock face (which the model used in this tutorial was originally intended for) doesn't usually have a flat surface. This means the original brushwork has to be made in such a way that any 'extremes' have to compensate for placement over a deep cut or around a long curved wall section. In other words, the support beams had to be made longer than normal so they could be embedded into brushwork comfortably without burying the point of origin of the model, as opposed to floating around in mid air because they're not long enough to reach the wall and you don't want to break the model by burring the origin point. Object centre and bounding box rendering ^Game engines tend to process and render models on a 'per object' basis and not a 'per polygon'. What this means is that a model will be processed in it's entirety if any part of it is visible; even a single small polygon being seen will result in the whole model it happens to be part being pulled into the game and processed; the 'area' or 'volume' the model occupies is often referred to as it's 'bounding box', so anything contained in that box will be rendered if any part of it is seen. To remedy this, large models need to be broken down into smaller more manageable and render friendly chunks, which then fit back together in the game editor - just like a jigsaw - allowing the game to process and render smaller chunks of data, making it faster and reducing something called 'overdraw' (where the engine is rendering polygons the player can't see).
In having to do this it does mean you need to be mindful that each section actually aligns itself properly in the editor and the 3D application you're using, each section needs to be re-centred to the 0,0,0 axis point before being exported back out for use in game.
POO based object rotation ^An object rotates around the point of origin so having that placed in an odd position may adversely effect how the model is manipulated, tiled and connected with other model sections. Where ever possible it's best to try and centre the POO at the objects centre of mass relative to the other sections or models it needs to fit together with. Make sure snap to grid is 'on' in your 3D app. Preparing brushwork for conversion to ASEPrepping the brushwork ^The basic principle of converting maps to models is to compile them as you would any other map and then 'convert' the resulting BSP to a model format; *.ASE in this instance.
Once you've selected, copied or created the initial brushwork that needs to be converted into a model it should be surrounded by a caulk 'hull' box. The box should encase the object; top, bottom and each North, South, East, West facing side. Make sure to also caulk all unnecessary faces of the brushwork object otherwise they will be present after the conversion and will need to be manually removed from the mesh in a 3D application. It's important that there are no gaps of any kind because the map will be compiled, gaps will result in the same type of 'leak' as you'd get normally when compiling a map to run in game.
The box then needs to have a info_player_start placed inside it, it doesn't matter where so long as it doesn't intersect or get in the way of any brushwork or the caulk hull - which would cause a 'leak' (due to a broken entity). As mentioned above in the 'Notes' to note' section it's important at this stage of the process to make sure the brushwork selection is centred on the editors 0,0,0 grid point relative to the eventual function of the object. If it needs to be buried into any brushwork, in the editor make sure that you adjust the objects to allow/compensate for this; a lamppost would have it's POO (positioned in Radiant) approximately halfway up the main pole to allow the bottom to be safely buried without problems. Map prepping checklist ^
Once this has all been done just (version) save the file (if you've got more than one version) to the defaults 'maps' folder for ease of use later. Using Q3map2ToolsUsing Q3Map2Tools to convert maps to models ^The following steps can be done using a BAT file, that's for hardQore mappers and not covered here. For the rest of us, using some sort of 'front end' that connects to the various options of Q3Map2 is preferable; in this case that's Q3Map2Tools.
What's actually being done in this tutorial is the compiling of a map file into a BSP in a similar way as would be done if it were for any Quake 3 powered game which is usually a three part process;
However for this map to model conversion process only the initial BSP stage is required. Quick set-up notes ^If this is the first time you've used Q3Map2Tools then when it opens you'll be asked to provide some information regarding the whereabouts of the *.map compiler - Q3map2 (see 'Design note' above); simply browse to the location it's installed and 'OK' the information to add it to the list.
Overview of Q3map2Tools ^When Q3Map2Tools opens it will present you with something similar to the image below. In essence the application is split into two sections; a map list section with all the *.map files sitting in your default maps folder listed; only one can be selected at any given time. And a compile options section with various options available for compiling and debugging maps. Once a selection is made from the list[1], various compile options are set[2] and the 'Run BSP' button clicked[3] to output a compiled *.BSP file which can then be run in game. Converting a *.map into a *.bsp ^As mentioned in the overview above, before a map can be converted to an ASE model it first has to be compiled to a *.BSP file. By default the 'Selected File' panel will show 'MapFiles (*.map)' as shown above, this is a listing of all the valid *.map files the tool finds sitting the default "/maps/" folder;
Converting a map with curves to a *.bsp ^If the brushwork object being compiled has or is composed of patch meshes or curves then a 'Custom' map2bsp compile is required before going on to the next step (this is because meshes tend to be treated slightly differently to brushes because of what they are);
This will save an 'optimised' file into the maps folder as above. Once the *.BSP file is created the next step can be started. Converting *.bsp into an *.ase model ^From the drop down at the top of the 'Selected Files' window select the 'BSPFiles (*.bsp)' option. This will show the map just compiled as well as any other previously compiled map files converted to BSP's. Do the following;
This will then output the converted BSP as an ASE saving it to the 'maps' folder. Make sure not to use the 'Build' button at the bottom of the application as that will try to do a full compile on the BSP and possibly error out. What should happen at the end of this is the production of an ASE mesh that's composed of the brush faces that were actually textured; anything covered in caulk is ignored by the process, including the caulk hull box which encased the brushwork (as well as the player_start entity). This means the end result is much 'cleaner' object for editing in a 3D application. Getting the converted ASE into a 3D applicationImporting into a 3D application ^So long as your 3D modeller of choice can import ASE models directly (native support or by third party scripts or tools) there shouldn't be any problems bringing the mesh in 'as is'. If not, an extra step will be needed requiring the object to be converted again into a format that can be used; Q3map2 only converts brushwork to ASE models. There are a couple of points that need to be kept in mind when bringing in converted models of this nature - in essence the only useful data that's brought in like this is the vertex and polygon face information, UVWs are kept but they're not really useful from the point of a model;
Because the compile process by default breaks brush data down into triangular polygons it means that converted models produced via this method are imported in the same state; they are composed of triangles rather than quadrangles (which is preferable for modelling). Brush faces by default aren't merged together to form a contiguous mesh, this means that each triangular polygon and it's three corner vertices are separate objects from their immediate neighbours. More often than not a mesh, although UVWmapped, will import into a 3D program without textures because of the way texture and shader paths are written to the ase file. As with un-merged vertices above, by default triangular polygon faces are not connected together, instead they are individual objects and need reconnecting in your 3D application. As mentioned above, a models position in a 3D application's viewport is relative to where it's placed in Radiant before exporting, maps sections can be built and exported in situ where required and recentred in the 3D app before re-export back out to ASE. Most 3D applications will have some method of merging vertices together and converting triangular faces into quadratic polygons, it's a good idea to do this where available to ease the modelling process. Once this has been done the mesh can be edited and then re-exported to ase once work has finished (covered here). |