Shaders for game

Source: Internet
Author: User

This title seems a bit strange. Most people think that the main purpose of shader is to serve the game. Unfortunately, this basic concept is the easiest to ignore. If you frequently access this blog, you will know that I have not written any articles about shader for a long time. Not that I am no longer interested in shader, just as everyone loves to write GUI programs, shader will always be the most exciting part of game programming-Get intuitive visual feedback of code right away, A sense of accomplishment. But when I went through a product development process and started researching engine design, I had some different ideas :).

When I first started learning 3D programs, I thought shader was amazing (I believe many people are also like me). I read a lot of articles about shader and wrote a lot of beautiful shader. Unfortunately, when a product was officially developed, it was found that most of the previously written shader could not be used. Why? In the process of learning shader, most people write programs that can only be called "Demo". We use cutting-edge graphics algorithms, hundreds of lines of HLSL code, to implement only one special effect. However, for a complete product, a large number of different materials/special effects need to be implemented in the scenario at the same time, and the system can run on the bottom hardware as far as possible. In the result demo, the parallax occlusion mappiing must be simplified to Parallax mapping or even normal mapping. Therefore, the shader for game development must be very practical and feasible, and must be optimized in a large number for specific games/scenarios, which are unexpected when we write a demo.

Rule No.1: when developing a shader for a game, you must always put the feasibility first. Remember that This shader must coexist with a large number of other shader, and do not let a shader drag a system down.

Next, Rule No. 2, the low-quality shader is worse than nothing! Oh, does this seem like a conflict with Rule No. 1? Neither. Continue to the previous topic. When you simplify a shader to the extreme limit to meet the system's needs, the corresponding problem arises: The image quality changes very poorly, and in the worst case, maybe a special effect becomes a feature that makes players hate. For example, since Doom 3, dynamic shadow has become a hot topic in game development. Almost all games regard it as one of the standard features. However, anyone who has implemented shadow ing knows that the seemingly simple shadow actually consumes system resources. Therefore, in order for the game to support such features, we reduced the shadow map size and simplified the sampling algorithm. The result is that although the dynamic shadow is obtained, the effect is very poor: obvious sawtooth, jitter and incorrect shadow. No one liked the shadow. Obviously, the serticate will only make the players feel annoying. Every time I encounter such a situation, I will close the shadow directly in the settings.

Therefore, with Rule No. 3, resources are used in the cutting edge. If you find that a special effect cannot be effectively implemented under existing resources, deleting this feature completely may be the best option to add saved resources to other existing special effects. Wow has no dynamic shadow since its release in November to last year, but this does not affect it as the world's most popular game. There is almost no need for gamers to constantly add shadows. in the Forum, there are more praises for the visual effects of new scenes and discussions on special effects of a certain skill. In a fierce game, no one cares about whether the shadow is correct. What makes the player more excited is the gorgeous special effects when releasing the skill and the other party's injury. Instead of spending resources on the thankless feature of shadow, I prefer to make skill special effects gorgeous and fancy.

Finally, Rule No. 4, the shader with personality is a good shader. Every time you develop a shader, do not use crysis as your reference. Even if you have successfully reached the level of crysis, people will only say, oh, another game similar to crysis. Your shader should make the game screen look different. If a player sees a video and knows that it is a certain game, then your shader or, in a further step, your visual effect design will be successful. In contrast, farcry 2 and crysis, after independently extracting a picture, it is difficult for you to tell which game they come from. Therefore, from a certain perspective, farcry 2 has failed.

 

 

PS: God. Today, I saw the csdn blog also had a message function, sweating-_-bbbbb .......

I am very sorry for the messages that were not answered in time>. <

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.