WMO (Wow map object) Research
The WMO is a very interesting design. doodad is used for small objects in WoW, while WMO is used for building,
The building here can be a house like a bridge, an observation desk, a simple small house, and a complex Hotel.
Complex buildings (such as underground city scenarios), this article briefly introduces WMO scenario files
For more information, see the source code of wowmapview. Thank you very much for your contribution.
1. Naming rules
WMO is stored in the file ending with. WMO. This file uses data blocks to save data. A WMO is usually composed of one or more
Group, and group data is stored in the file ending with. WMO, but the file name is different, such as a WMO
Save it In the name. WMO file. The group file name is name_001.wmo name_002.wmo ......
2. Structure
WMO has two layers: group and batch. A group usually contains multiple batchs. A group contains
An AABB. Batch is the smallest rendering unit of WMO. It stores the vertex index list and can directly call DP for rendering. Group
Groups can be divided into two types: indoor and outdoor. This information is very important.
Building is divided into two parts: Internal and External. The outdoor group is the building housing, which is connected to indoor scenarios through the portal.
Together.
3. Portal
The WMO file stores the portal information. In WMO, the Group must be connected through the portal. The portal consists of PVS and PRS.
PVs records the vertex information of the portal and the connection information of the portal and group. The structure of the PRS is as follows:
Struct wmopr {
Int portal;
Int group;
Int dir;
};
Note that the Dir member has only two values-1 or 1. Because the vertex information of the portal is recorded clockwise, the Group
DIR is 1 on the front of the portal; otherwise, it is-1. You can use dir to quickly determine which side of the portal the group is located on.
Using the portal information recorded in WMO, you can use portal culling to check the group's visibility, but there are still some
Difficulty, mainly refers to the portal record method. A group may have multiple portals, but the portal for searching for connections can only
Through PRS, this is very inconvenient in large scenarios. In addition, WMO does not record the portal's plane information. How can we determine
Is camera on the front or back of the portal? (Because WMO files are not completely cracked, some wowmapview files exist.
Unread data blocks, such as mver, MOPT, movv, and movb. The mver must be the version number of the WMO file.
Stores all the plane information, while movv may store the information of the surrounded body vertex, while movb stores the information of the surrounded body. movv and movb should be used
Collision Detection, these are not verified at the moment) My approach is to calculate the portal's plane information during loading and convert the PRS information to something similar
The portal structure in Q3 BSP.
Struct portal_t {
Int othergroup;
Int PVS; // PVS Index
Int dir;
};
Struct group_t {
Int firstportal;
Int numportals;
};
4. Collision Detection
In WMO, no structure such as BSP and OC tree is used for Scenario Management, and everyone may feel very confused.
The scenario management function is mainly used to accelerate rendering and facilitate collision detection. Because of the portal, the first function has been completed.
For collision detection, my idea should be AABB tree. Observe the wow scenario to find the surface and slope in the indoor scenario.
There are very few such geometric objects, most of which are rule objects. Therefore, we can judge that all objects in WMO are strictly aligned according to the axis.
Model, that is, the regular object AABB = OBB. Because the movv and movb information is not fully studied
This part can only be my guess.
5. Rendering
Rendering of WMO is simplified because of the existence of batch, but there is still something to optimize. Because WMO uses the portal to split it
As a group, a large number of models with the same material are divided into different batchs, and the same batch is combined during rendering.
Rendering can avoid unnecessary DP calls. WMO is criticized for using Vertex light. To reduce the number of elements
Reduce the number of vertices, resulting in a ribbon effect during rendering. We should add lightmap. Because the WMO scenario is usually not large, preprocessing
The time required for performing radiosity is not too long.
6. Dynamic Loading
For small scenarios that only contain a few groups, since the loading time is not too long, one-time loading during dynamic loading has an impact on the program.
It is not too big. However, for ultra-large WMO scenarios, you need to consider the loading policy. In this case, the typical scenario is the underground city scenario in WoW,
It contains hundreds of groups in a WMO. The one-time loading takes a very long time and needs to be loaded in segments. The WMO score is displayed.
The advantage of the file storage group is that to achieve dynamic loading of WMO, one possible approach is to load WMO according to camera
You can quickly create a group connection hierarchy chart based on the group data. The process is as follows:
1. Use the group in which camera is located as the current group to obtain all connected protal;
2. Save the group connected by protal to the list at the first level, and traverse all groups in the list at the first level;
3. Obtain the group portal in the first-level list and check whether the group connected to the portal is saved in the first-level list. If no
Save it to the second-level list;
4. Repeat the above process until the entire hierarchy chart is created.
This level chart can be created in advance and saved to the file for loading. In this way, WMO is a layered load without one-time loading.
(Can I create PVS data similar to BSP in WMO? Although PVS has already been phased out, if
With PVS, you can easily determine which groups need to be loaded immediately, but you do not know whether the group after the portal is split is convex.
If yes, you can create PVS, but the modeling time limit is more obvious !!!)
7. Modeling
Since WMO saves the scenario according to group, a powerful model building tool needs to be designed to establish WMO. This tool
The main function is to group and process scene models created from the modeling tool (3DS MAX. The artist needs
Be careful that all models require strict axis alignment (the reason for axis alignment is that AABB = OBB of the model is required), and then import the model into the tool.
The model building tool has the following functions: group function, group selection, group display/hide, specified portal, portal
Qi (considering the natural portal such as doors and windows, the portal cannot be aligned with the external wall when manually specified, and the program must be automatically aligned)
Batch operations (segmentation, selection, display/hide, etc.), metalevel operations (Triangle sorting, used for batch segmentation), and illumination operations
(Generate vertex light data), place a light source, and place a doodad (such as a table or Chair ). You may also need
He has some functions, but it is much simpler than the scenario modeling tools (hammer and sandbox) of other engines.
8. Advantages and Disadvantages
Currently, the mainstream technologies for processing indoor scenarios are still BSP, but with the development of hardware, the advantages of BSP are gradually lost, and BSP depends on its survival.
Pre-processing PVS has now been completely replaced by real-time portal culling. The BSP advantage is only the sorting of elements (used for transparent objects ).
Rendering) and the rapid Collision Detection Based on the brush, but compared with the complexity of modeling tools and the constraints of the scenario, the overhead of using BSP is indeed
It looks too big. The structure based on the pure portal engine has become popular. For example, the BSP is completely discarded when the cryengine processes indoor scenarios,
The scenario is completely composed of blocks of fixed-size walls. A wall is similar to a brush in BSP. The advantage of this is that the modeling tool changes
Is simple (no CSG operation is required), and it is very easy to generate a portal. At the same time, because of the use of a brush
BSP facilitates collision detection. WMO is similar to cryengine, but it is more advantageous in some aspects.
First of all, in terms of modeling, WMO scenarios can be fully built using mature modeling tools, so that the artist does not need to learn new
Modeling tools can save a lot of time. Second, the model building tool requires very few functions, which reduces the complexity of the program and shortens
The time when the related tool was written. Thirdly, the scenario management is simplified, and the corresponding code volume is greatly reduced. At the same time, due to the existence of the portal, it is convenient
Is connected to other engines. It can be said that WMO is a scenario structure that can be quickly developed.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.