Dense lawns have always been difficult to express in 3D games, because rendering lawns requires a large number of polygon and a high pixel filling rate. However, the gaming industry has never given up its desire to render lawns. About two years ago, some promotional texts of Games gradually promoted dense lawns as their own characteristics. The Treasure of the treasure of wonder, a fixed-angle game, impressed many people. However, currently, lawn rendering is still not a simple task. A masterpiece like World of Warcraft just uses grass as an ornament and places it on the terrain.
Finally, I couldn't resist the temptation of lawn, and added the lawn building system to the terrain editor. The results of system implementation are satisfactory. The following features are summarized:
1. Art does not need to provide grass models. As long as the grass textures with symmetric edges are provided, the system will automatically generate cross patches.
2. vertexshader is used to control the four vertices on each grass to swing according to certain rules to simulate the effect of breeze blowing.
3. obtain the ground light brightness information from the ground where each grass is located as the basic brightness of the grass. The above four vertices are randomly brightened by a range, the following four vertices are randomly dimmed to simulate uneven illumination of the grass.
4. Draw the invisible patch by means of the cone clipping and the PVS information mentioned earlier, and update the grass on the visible patch to a dynamic vertex buffer by sort by category. Each grass is drawn by a drawindexedprimitive call. The total number of calls will not exceed the grass type.
5. A special record method is used, which occupies only four bytes in the storage file.
6. The grass-laying system is fully integrated into the existing Undo/Redo architecture.
Through Cone Cutting and PVS elimination, and a few dip calls, the grass-laying system achieves good rendering efficiency. In the future, the terrain design should be able to show the grassland effect more freely, it provides richer landform features and a more interesting gaming experience.