Technically speaking, mapmodels are pre-compiled geometry parts (or objects) which can be included in a map. This includes stuff like chairs, tables, trees, and the like. These models are supplied with the game you make the maps for, not the editor itself, but it's also possible to create such objects. Mapmodels are usually made using modelling software such as 3DSMax or Blender, and for the id tech 3 engine, they usually come in the .md3 format. Using models, or even making your own can really simplify making your map, or at least visually spicing it up. In this section we will talk about how to place these mapmodels on maps, and also how to create and export them into the .ase format.
For the record, .md3 mapmodels can also be used in maps, and there's even an appendix on how to create model-based maps, but this part of the manual doesn't cover how to create them with other modelling programs such as Blender and how to create player models. For this you have plenty of tutorials out there.
Also, in order to avoid confusion and differentiate them from playermodels and itemmodels, we're going to call these mapmodels.
Why use mapmodels? Edit
Sometimes when you add patch trims even though vertices align perfectly in the editor, in game holes or tears appear when the geometry is rendered. These are known as LOD (Level of Detail) cracks. These errors are caused by the OA code itself in the way it calculates the drawing of curves. Small LOD cracks can be stitched by the game, but some will be quite visible. In order to avoid this, we will use mapmodels.
- They don't suffer LOD cracking.
- You can rotate and scale them in any direction, unlike brushwork or patchwork, where this isn't a good idea most of the time.
- Models are non-solid, so they won't interfere with the BSP process.
- Models can be reused and remapped.
- Marks on walls won't work with models.
- Models are baked into the BSP, so if you're going to edit a model-heavy map, beter have the correspondent files in your models/ folder.
Let's start talking about the misc_model entity. It's the entity which serves as a placeholder for the mappers to place models on their maps. It requires compilation of map geometry to be added to level.
- angle: direction in which model will be oriented.
- model: path/name of model to use.
- angles: Individual control of PITCH, YAW, and ROLL (default 0 0 0).
- modelscale: Floating-point value used to scale a model up or down (default 1.0).
- modelscale_vec: Floating-point vector used to scale a model's axes individually (default 1.0 1.0 1.0).
- _remap: Used to remap textures/shaders in the model. To remap all shaders to a given shader, use "*;models/mymodel/mytexture". To remap a specific shader, use "models/mymodel/old;models/mymodel/new".
- target: Used to attach the misc_model to a brush entity, where its "targetname" key is the same value.
- _lightmapscale: Floating point value scaling the resolution of lightmaps on this model (if model is using lightmapped shaders) (default 1.0).
- _castshadows: Also _cs. Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
- _receiveshadows: Also _rs. Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
- _celshader: Sets the cel shader used for this geometry. Omit the "textures/" prefix.
- CASTSHADOWS: Toggles the model casting shadows on the map surfaces.
- AUTOCLIP: Sets the autoclipping spawnflag, automatically assigning q3map_clipmodel to any shaders used by the model.Use of Q3Map2 autoclipping for models is only recommended for large models with relatively few triangles in their mesh (i.e. terrain). The Q3Map2 autoclipping algorithm is a bit of a hack, and can hurt in-game performance (as well as produce erroneous clipping results) when used on small, dense models.
- AUTOLIGHTMAP: Sets the forcemeta spawnflag, automatically adding q3map_forcemeta to any shaders used by the model (which, in turn, allows the model to become lightmapped). This, effectively, is the "lightmapped model" spawnflag.
Placing models into maps Edit
Before going into this part of the tutorial, it would be a good idea to uncompress all of OA's default mapobjects into a folder inside of baseoa. This folder should be called models. In the Appendix E2, you have downloadable packages with these models in both OA 0.8.8 and OA SVN r951 versions so you can decompress them into the baseoa folder.
The process for mapobject placement into a map is pretty simple and straightforward:
- Create a misc_model entity.
- Search for the desired model to place.
- Move the model to the desired position.
- Encase the newly summoned model with a few simple brushes texturized in all of their faces with common/weapclip, roughly following the shape of the model itself as close as possible. This allows models to block weapon fire, other than players.
- Encase the whole model into a simple, single, axial brush texturized in all of its faces with common/botclip. This ensures that there won't be problems with botplay. Alternatively, you may use common/clip instead, in case you wish to keep both bots and humans at the same distance from the model.
- Open the properties for this misc_model and set the spawnflags "CASTSHADOWS" and "AUTOLIGHTMAP" ("spawnflags" "5") and the key "_lightmapscale" to "0.125". This allows the model to be lit in-game and have a good lighting.
Lighting a model Edit
Some models just need more light, as some of them don't cast light at all or cast very few light into the level. For spotlights, this is an annoyance. What you have to do is to give them a light and target it to an info_null or info_notnull.
Converting brushes into .ase models Edit
In model file formats, the .ase (short for ASCII Scene Exporter) format is a format created by Autodesk based on identifiers, all in the form *ASTERISK_THEN_NAME, which are followed by zero or more values, and then for a few a block of further identifiers surrounded by curly braces.
The process to convert geometry to models using the editor is the following:
- Select the geometry you want to convert into a model and copy it. It could be a fountain, a lamp, whatever.
- Save your map, and open a new one.
- Paste the copied geometry into the new map.
- Clean the geometry, caulking unwanted and unseen faces, texturizing the faces to be seen, and optimizing the geometry so it doesn't display too many unnecessary vertexes once baked into the level.
- Surround the geometry with a hollowed caulk cube. Caulk doesn't get rendered while converting the map into a model.
- Make sure that the geometry as a whole is placed in such a way that the origin point (0,0,0) of the world is inside of the model geometry, or at least touching it. This is necessary as the model control point is always created at 0,0,0. If you don't move the geometry the result can cause a leak if you insert a model into a map with its control point in the void.
- Place an info_player_start entity. In this case, it's the only one which can work.
- Remove any game related entities and un-group any brush based entities so they become raw brushes again.
- Save this new map with a model-based name (i.e. mymap_lamp.map) and compile it with the following lines:
q3map2 -meta -patchmeta -subdivisions 6 mymap_lamp.map
q3map2 -convert mymap_lamp.bsp
Remember to replace mymap_lamp for the name of your model.
- Move the newly-created .ase file into a folder inside of the "models/" folder. I.E. "models/mapobjects/mymap/mymap_lamp.ase". Remember this path, we're going to use it in the next step.
- Open the map you were working on, and in any of the 2D views place the newly-creted ase model as described in the previous section.
- That's it!
Other model tricks Edit
Remapping a model Edit
Sometimes it's necessary to change a texture of a model in order to make it reusable. For example, you want to change the texture of a rock model so it becomes a ice rock. Here's how to do such thing:
- Open the misc_model entity properties.
- If you want to change every shader/texture of a mapmodel into a single one, add the key-value pair "_remap" "*;[newshaderpath]" where [newshaderpath] is the route of the replacement shader/texture.
- If you want to change the shader/texture of only one surface of a mapmodel into another, add the key-value pair "_remapNN" "[oldshaderpath];[newshaderpath]" where NN is the surface of the model (findable by looking at the .ase file with a text editor), [oldshaderpath] is the route of the shader/texture to be replaced and [newshaderpath] is the route of the replacement shader/texture.
In order to see the change, you must recompile your map. The changes aren't visible in the editor.
Searching for the surface Edit
If you want to know the number of the surface in a model you want to change, you have to follow these steps:
- Open the .ase model with a text editor.
- Locate among the materials the route of the texture you want to replace. Pay attention to the number in the line MATERIAL line above the section.
- With the above number in mind, search for any line called *MATERIAL_REF which has this number. As the line uses tabulations, the recommendation is to just search for *MATERIAL_REF and stop anytime you see the number.
- For every *MATERIAL_REF with a number equal to the one you're searching for, you must take note of the number of the surface. It's located near he top of the section, the line is *NODE_NAME "matXmodelYsurfZZ" where ZZ is the number of the surface to be replaced.
- Once you have the number of the surface, enter to the editor, select the model, and enter the key-value pair "_remapZZ" "textures/oldtexturename;textures/newtexturename".
For a quicker work, you might be interested in using a text editor which supports section collapse such as Notepad++.
Rotating a model Edit
- Use the "angle" key in order to rotate a mapmodel only by using the Z axis. The key-value pair syntax is "angle" "[number]" where number is the rotation angle, i.e. 90.
- Use the "angles" key in order to rotate a mapmodel by using any of the three dimensional axes. The key-value pair syntax is "angles" "[numberX] [numberY] [numberZ]", where number is the rotation angle of each axis.
Scaling a model Edit
- Use the "modelscale" key in order to scale a mapmodel in all three axes at the same time. The syntax is "modelscale" "[multiplier]", where multiplier is a floating point number which the original scale is multiplied, i.e. 1.3 makes the model 1.3 times bigger.
- Use the "modelscale_vec" key in order to scale a mapmodel differently depending on the chosen axis. The syntax is "modelscale" "[multiplierX] [multiplierY] [multiplierZ]", where each multiplier belongs to a different axis.
Other supported model formats Edit
In addition to .ase and .md3, OA maps support many other model formats, at least editor-side.
- LWO - Lightwave Object
- OBJ - Wavefront ASCII
- 3DS - Autodesk 3DStudio
- PicoTerrain - PicoTerrain
- ↑ Wikibooks' Models
- ↑ 2.0 2.1 2.2 LevelDK 3: .ase models
- ↑ GTKR Manual misc_model
- ↑ Entity keys at Q3Map2 manual.
- ↑ You need an updated gamepack in order for these to be shown in the editor, otherwise you have to manually add the "spawnflags" key with one of these values.
- ↑ See also Mapping manual/Bot play page for infos about "clip" brushes.
- ↑ WeMakeMaps.com Add Light To Models
- ↑ ASE File Format on UnrealWiki
- ↑ 9.0 9.1 Making models from .map files, at Kat's Bits
- ↑ 10.0 10.1 10.2 Model Tricks