Scenario and track creation-Summary

Source: Internet
Author: User
Summary

In this chapter, you have learned a lot about rendering complex 3D objects, such as scenes, tracks, and creating checkpoints in racing games. Hope it can also be used in other games. Remember the following when creating a scenario for the game:

    • It is always the first time to determine how players look at the scene. It doesn't really make much sense to look at a very good scenario. This scenario is only great at close quarters. It covers only 50 meters and 2 square meters in strategy games, RPG games, or racing games. In this type of game, you need a larger area, which means you either repeat the texture or have a better rendering technology to integrate the detailed texture into a large texture, or use splatting to "Draw" the scene ground.

    • Splatting is a good technology for creating giant scenarios. Most games use texture splatting and use different ground textures and extra special textures, tracks, and so on to form a nice terrain. If you don't have much development time or you don't need a huge terrain, you can use the simple solution shown in the previous chapter. This method is good for shooting games.
    • Additional layers, shader and special effects, especially the shader and shadow ing, are very time-consuming tasks. I did not specifically use the water surface effect in the game, because in the past few projects, it always takes several weeks to get a satisfactory water surface effect, I know myself-I will keep modifying it until I am satisfied, but often there is not so much time.
    • You can learn many tips and tricks from other people, tutorials on the Internet andGame programming gemsOrShaderx SeriesThere are a lot of good resources in the book.

There are similar rules for generating tracks. It is important to create a unit test first. Always test the performance, especially when you create an area with many polygon, in this chapter, we use about 130000 polygon and up to 24000 polygon, there are also an additional 50000 + polygon for track guardrails, tunnels and cement bars supporting the track. This means that even if no additional scene object exists, more than 200000 polygon will be rendered at each frame, that is to say, when the frame rate is 100 frames per second, the optical Rendering scenario and the track need to pass more than 20 million polygon to the GPU within one second. A car has about 25000 polygon and thousands of scene objects. This means that if there are 1000 scene objects, millions of polygon will be rendered at each frame. It sounds a lot better, but if you look at the testrenderlandscape unit test, you will find about 2000 objects in the scene.

You may think that the GPU of the Xbox 360 game host may not be able to process 2-3 million polygon within one frame time and still maintain a frame rate of over 60 frames per second. Worse on the PC, 75Hz is the most commonly used screen refresh rate, and most gamers are too slow to process all 3D geometric data within one frame. To ensure that the game can still run well on mid-range or low-end computers, the following tips are used:

    • Do not render invisible things. Scenes and tracks are always visible, so you cannot ignore them. However, many scene models may be behind you or beyond your field of view. You can simply ignore them. Another trick is to ignore any model that is too far away, especially a small 3D model that is 100 metres away. This is the best technique to improve game performance. Take a look at the model class and render method to learn more about this technique.

    • Rendering a large amount of GPU data at the beginning of each frame. In this way, you can prepare the scene model and other rendering data while the GPU is still processing the scene and track polygon.

    • It is always rendered by shader sorting. In the previous games, you have seen how meshrender is used and how it greatly improves performance. In the performance test on racing games (see the model class), I continuously improve the performance of the meshrendermanager class. Especially when using the same shader for a large number of objects of the same type, the performance is surprising. View testrendermanymodels unit test. It passes over 0.1 billion polygon to the Xbox 360 GPU (or your PC if your GPU is fast enough ).

    • Use a simple Shader! All objects in the original version of the rocket Commander game use parallaxshader. Compared with normalmapping shader, only a few additional commands are added, but it still takes more time than normalmapping. Therefore, only normal ing is used in racing games, and the visual effects are not significantly different. Only the scenario uses a more complex shader to add detailed ing effects (see figure 12-7; this is indeed worthwhile ).

Well, before all this new knowledge explodes your brain, relax for a while. Chapter 2 is about physics and involves a lot of mathematical knowledge. When you read chapter 1, you will eventually be able to integrate everything together.

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.