World of Warcraft terrain research

Source: Internet
Author: User
The amazing terrain of World of Warcraft mainly lies in the seamlessly connected world and the fine rendering effect. Wowmapview Source code and display in box frame mode D3d ProgramThe analysis tool, which can be a glimpse of its implementation.

 

Organization Mode

World of Warcraft uses a segmented terrain, which is the basis for seamless map.

from the wowmapview source code, the whole terrain corresponds to a mapworld , this terrain can be the whole continent of kalimdo and the entire eastern kingdom. If you are on the battlefield, it can only be a map of the battlefield. Each mapworld divided into 64x64 maptile . maptile further divided into 16x16 mapchunk .

At any time, the program always saves the player's location and its surroundings 3x3 Items Maptile As players move Maptile Will be dynamically updated, new Maptile Loaded to replace the old uninstalled Maptile . To improve scheduling efficiency, Warcraft introduced Cache Mechanism, Cache Maximum number 16 Items Maptile Data. New Maptile First Cache Find; unmounted old Maptile It will not be deleted immediately, but saved in Cache . Because the range of player activity in a period of time is usually not significantly changed Cache The strategy is outstanding in the application. This is the basic principle of seamless map.

As the basic rendering unit of warcraft terrain, eachMapchunkInclude9x9 + 8x8Terrain vertices, as shown in the vertex layout.

To improve rendering efficiency, Warcraft adopts second-level staticLevels. That is, the rendering time, according to eachMapchunkDistance from the camera, using two precision vertex indexes. This is where the World of Warcraft is located at the edge of the void storm map in wireframe mode.

For reference, the first-level vertex index method may be like this.

It is difficult to determine the second-level vertex Index Method Based on World of Warcraft in the wireframe mode. In the game, low-field view settings are usedMapchunkWill be cropped by the cone; use the high field of view settings, distantMapchunkThe first-level vertex index will still be used for rendering. In fact, I have never seen a terrain block drawn using secondary vertex indexes in actual games. You can referWowmapviewOr you can use your own secondary vertex index. Generally, the number of secondary vertex indexes is half that of the primary index.

World of Warcraft supports hole mining. This function is used in underground mining holes where the Dwarf Village has a basement. EachMapchunkSupport Mining4x4Holes.IntType stored inMapchunkMedium and low16Bit4x4Whether or not each hole is opened, high16The type of the corresponding hole. The following is the dwarf bunker on which danmoro goes deep into the ground. You can clearly see the holes dug on the terrain connected to the bunker.

Water Body information is stored inMapchunk. CorrespondingMapchunkThe vertex distribution of each water body and its index.

EachMapchunkSaves a series of water information that covers itFlagValue.FlagThe value includes whether or not each unit of the water body is enabled, the color of the water body, and the type of the water body. In the twilight Creek, purple water shows the distribution of water body vertices and the indexing method.

 

Rendering skills

Warcraft uses a multi-layer terrain texture hybrid method to render the terrain, which is also widely used by various games. Generally, Warcraft is used 4 A terrain map and a mixed texture R , G , B Before the channel 3 Secondary mixing weight, A Channel indicates whether the shadow is used. Terrain Maps are generally stored in Mapchunk Repeat up 8 And the general size is 64x64 Only repeat once, that is, each Mapchunk Corresponds to a hybrid texture. This one 64x64 In the hybrid terrain, it provides sufficient guarantee for the fineness of the hybrid terrain.

it is unclear why the current worldmap A rough height 64x64 vertex list, corresponding to 64x64 maptile . At the beginning of rendering, the current fog color is used as the output color. First, the list is rendered. One possible reason for this is that when the game's field of view is set very low, the terrain in the distance will be cropped, And the vertex list will provide the terrain fill in the distance with the combination of fog, it does not have the effect of terrain truncation.

Next3x3ItemsMaptileDraw them one by one. In eachMaptile, Use the quad-tree to manageMapchunk, EachMapchunkBased on the actual distance between the camera and itself, select the following rendering policy:

1.Long distance. Secondary vertex index, usedNodetailRendering policy. Only set the fog color to the vertex color, regardless of texture sampling and illumination.

2.Moderate distance. Secondary vertex index, usedDetailedRendering policy. Illumination, texture mixing, and shadow are all processed.

3.Relatively close. First-level vertex index, usage and usage2SameDetailedRendering policy.

Finally, the rendering of the water body. WarcraftWlkThe previous water body is basically used30The water surface is rotated to form a ripple of water waves. In the data file "catastrophic events", the Water Effect of real-time rendering is added.

The basic techniques of World of Warcraft terrain rendering are not yet able to get that impressive Terrain Effect in the real game. Among the many factors that affect the terrain rendering effect, illumination actually accounts for a large proportion. After processing the illumination model well, the rendered terrain will have unexpected effects. Like the chef's secret recipe, the focus of warcraft terrain lies in the highlight texture.

Since ambient light and direct light can only provide basic light and shade effects for Terrain vertices, the reflected light can be used as different illumination based on different vertex locations and is introduced to the illumination model of warcraft terrain. The introduction of reflected light will make the terrain look like a glaze, so Warcraft will make the terrain textureAlphaChannel, as its corresponding highlight texture, controls the light intensity of the point. It is worth mentioning that the lighting processing of warcraft's water rendering is also similar. This simple technique is enough to improve the terrain rendering of Warcraft to the precision of pixel-level illumination. In fact, it plays a key role in the delicate terrain effects of warcraft Tiancheng.

 

Demo

Empty implement a preliminaryDemoAs a validation and summary of the above research. It supports seamless maps and uses all rendering techniques mentioned in the article.

This shows terrain mixing, hole digging, and second-level staticLevels. The artist is a little poor.MapchunkBecause the same texture and height are used, you can see that terrain blocks with the same appearance are repeated multiple times.

This shows the illumination effect of the terrain. The use of highlight textures greatly improves the fineness of the terrain. Players who often enter the Aoshan battlefield should have deep feelings about the cold and reflective effect of this rock.

This shows the effect of water bodies. The large and small water bodies distributed all over the world of azelas basically carry this sparkling Warcraft brand.

DemoThe source code is not published for the time being and will be applied to the actual project as a mature solution after further improvement.DemoThe techniques used are described in this article and the principles are relatively simple. You can try them on your own.

This is the best terrain I have baked.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.