Map Objects
Map Objects are 3D models that are placed within a map in order to increase the percieved detail of the map itself. Examples of map objects include plants, trees, light fittings, tables, chairs, computers, trash, lightposts and other miscellaneous items.
Contents
Usage
To create a model-based map object, create a model_static or func_static entity. A model can then be assigned to the entity, for example models/mapobjects/fencing/fence_wire01.lwo which is a section of metal fencing for use in any map.
In-game, mapobjects can behave in a number of ways. The most simple of which is triggering a mapobject, which will cause it to toggle itself between being visible and being hidden.
Collision
Models are collidable in the same manner as geometry, but adding a detailed model can have a significant impact on the collision data used by the map, and result in a decrease in performance. To alleviate this issue, many models have custom, simpler clipping hulls defined inside the model itself. Some models also have additional clip surfaces in order to prevent players getting caught or stuck on the geometry.
Usually, collision data is shared between models in order to reduce memory usage. However it is possible to merge a model's collision model into the world model using the mergecm parameter, which gives faster collision checking, at the cost of using more memory for each and every instance that does this.
Models can also be made non-collidable by setting their noclipmodel parameter, which is ideal for models that are insignificantly small or unreachable by the player. This saves memory.
LOD
Some models exist in two guises: a 'normal', high-polygon version for when the player is close-up, and a 'minvis', low-polygon version for when the player is far away. By using LOD Groups, the high-poly versions can be set to vanish at a distance, and the low-poly (minvis) versions appear in their place.
Combined with batching, this approach leads to extremely effective performance gains with minimum memory penalty (since the 'minvis' versions typically have only 25% the number of triangles of the original.)
Models should be placed in LOD Groups in the same fashion as brushwork and other entities. They can then be set up to not render at all at a distance.
Batching
Batching involves the re-use of the same texture across many triangles, which allows the renderer to draw all triangles at the same without needing to load a new texture. It is generally better to use a variety of models that use the same texture than it is to use a variety of models with a unique texture on each.
Because textures can be shared between models and the map, if a model uses a texture it is acceptable to use that same texture for map geometry as well. If both appear in the same scene (and the model is not instanced), both the model and the map triangles will be drawn in the same batch.
Careful choice of models that share the same textures can lead to a dramatic increase in performance.
- See Batches
Instancing
Instancing is the re-use of model data across a map in order to save memory and improve performance. When a model is placed several times in a map, its triangle data is saved for each occurrence. However if the model is instanced, its data is saved out just once and shared between each instance in the map. This results in a smaller map file and less data to manage.
- See Model Instancing
Map Objects versus world geometry
Map objects are generally preferable to world geometry for details, and should be used wherever achieving the same effect using brushwork or patches would be either difficult or inefficient. Objects that appear frequently - such as light fittings, trees, vegetation - or generally feature en-masse, are best created as models and inserted into maps where appropriate.
A second use for map objects is for geometry that is hard to create with brushwork. Some buildings and structures used within ETQW were created as objects to save having to create complicated or precise brushwork in their place.
Dynamic Entities
A map object can be created out of brushwork by making the brushwork a func_static entity. The entity then shares some of the capabilities of model_static entities, allowing for parts of the level to be turned on/off live within the game itself. Triggering a map object from another entity will cause the entity to disappear, and re-appear if triggered a second time.