Batch, plant, geometry &

Source: Internet
Author: User

Summary of this phase

In general scenarios, multiple identical models need to be drawn. The common solution is to use one vertex buffer for each model and one drawprimitive (or drawelements in OpenGL ), in this way, too many DP calls will limit FPS, so there is the xxx instancing method, which leads to a series of ideas.

Batch
In the unit of the current shaderconst, allocate a VB with the space size = the size of a single instance X number. The size of number depends on the amount of information in each instance. Then, before draw, each instance submits personal information during attach, and at last, the number of DP calls can be reduced to the number of instances/number (+ 1) During draw ).

Plant
A typical Extension: there will be a lot of flowers and grass in the scenario, and they will "swing with the wind ". Therefore, they are the most suitable technology for using instancing. As for Swing, using shader simulation is much more efficient than using dynamic buffer frame animation.

Geometry
Note that when preparing the VB required by batch, you need to write the index information and adjust the index buffer, so pay attention to the correct data after the reorganization.

VS
Because you need to check the number of shaderconst support, you must take caps directly. maxvertexshaderconst, and instancing needs to write shader. After testing, we found that there are 96 vs1.0 (1.1) and 256 vs2.0, so we provide 2 versions.ProgramAutomatically select based on configuration.
It's not that simple. When gf3 or below or gf4mx is used to simulate vs, the number of software_vertexprocessing is 8192, And the vs version is 3.0 ...... Well, judge whether it is HW or SW.
Temporarily OK. After a while, the tester shouted: Why is nothing missing ?!?!! I did not think about it. Wow, his video card is ATI 9000. Check caps and faint. shaderconst is actually 192, vs1.1, vomiting blood ing ~ I had to add another version ......

Perception: a new technology, switching from demo to practical, needs to consider more things. Due to the original reasons of the PC platform, more exceptions should be noted compared with the console. Programmers, especially game programmers, have a hard time ...... Happy too ~ Pai_^

 

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.