Ogre rendering optimization experience (III)-optimizing the terrain of tianlong Babu

Source: Internet
Author: User

One way to achieve terrain is to use a grid. Each grid has a quadrilateral, which does not share vertices and does not support the level of detail. However, a grid can have multiple layers of texture, which is suitable for 2.5D angle-of-view games, such as Warcraft 3 and tianlong

The other is the mainstream 3D Game practices, sharing vertices and dles. The disadvantage is that the texture layers of a terrain page are as many as those of the previous terrain... for example, eight layers are enough, and texture transition is quite natural. the texture transition of the grid fight is always ugly.

1) The terrain implementation principle of tianlong is as follows.

The entire terrain is composed of multiple tile, class terraintile: Public ogre: movableobject

A tile is a movableobject used for camera cropping.

Each tile contains a renderablelist. In a tile, the lattice of the same material will be made into a renderable,

Tile is 32, so there are 32*32 grids. If these grids use 10 different materials, These grids will be made into 10 renderable

Rendering is no problem. rendering by material in batches, 10 in batches,

But there is a problem with camera cropping. The camera can only crop by tile, because tile is movableobject, but the 10 renderable cannot be cropped separately.

In this case, for example, if the camera only sees one of the most edge grids in the tile.32 * 32 lattice, it will also render the entire tile, with 10 batches ....

If you make all 10 renderable into movableobject, You can crop it. If you only see this grid on the edge, only the renderable on the edge will be rendered, one batch.

Practice has proved that for a 2.5D game, the number of terrain games can be reduced by almost half.

2) tile size

How big is tile, and the most efficient? This is related to the camera. It is best to have a game perspective. The camera looks a little larger than that. tianlong's 32 is reasonable for his perspective.

3) Texture Atlas

Tianlong's surface texture is very small, 128*256 leads to a lot of materials and a lot of batches. If texture Atlas is used to synthesize small textures into large textures, the number of batches will be much reduced, however, there will also be other additional problems, such as the gaps caused by mipmap, to solve the gaps. There are actually many solutions abroad, such as writing shader and adjusting texture coordinates under different mipmaps, or reserve the texture coordinates and add a circle of pixels with the same edge on the existing texture, so that no other texture pixels will be obtained, resulting in a gap.

Tianlong 2 adds the sky perspective. Even if many scenes are seen, rendering efficiency is not greatly affected. Therefore, I personally think that he should make texture Atlas to reduce the number of batches of the entire scenario, otherwise, the sky perspective cannot be realized.

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.