Shader--The era of mobile-time

Source: Internet
Author: User

TA has more than two years, there are more times on the market hand tour appears, however, many project groups are still deterred. The most tangled is the problem of efficiency,

Today, according to their own understanding, talk about how you can do a high-efficiency sub-era hand-tour.

In the second time, the most representative piece is the scene, which occupies a large proportion of the people's vision, and the scene is the most important is the surface, so today

Just talk about sub-era production of the surface.

A. Decal section

First, a surface needs to contain diffcuse, bump, spemask such as

Spemask can be placed in the diffuse channel, but the compression band channel map is not so easy, so put it up as a new map

And only need one of his channels, other channels can be used with other stickers, a mask map of the RGB can be 3 map of the surface

Spemask, it is not a special waste to see.

Two model parts

This model has nothing to say, remember a principle, large structure with a model to do the structure, small structure by normal and map to express, this is the basic requirements of the Times

Can save the province

Three shader parts

This is a key point, we will find that the support Normals support the specular map, then we need a real-time light, otherwise after baking, the lights are off, sheng

The most original diffuse effect + baking chart effect. For example: The left image is baked before the right picture is baked

On the basis of baking, add a directional light, its normal effect with the high-gloss effect will come out. But add a lamp, it is necessary to consider the real-time lighting, its consumption is

It's conceivable. Long-winded, we want to achieve is, in the case of not real time how to achieve high-gloss and normal effect. Then I'll have to start with shader, in shader.

Plus a variable that simulates real-time lighting.

The surface information contained in a directional light is

1 Lightdir Direction

2 Lightcolor Color

3 Intensity Strength

As for the deep-seated information, such as whether the shadow of the object is involved in baking .... Too much, I think, is the main cause of his efficiency, but for us and

Not important, we replace these three variables with the light parameters in shader:

Properties section

Shader"game_xxx/scenes/ref_static"{Properties {_hightlightstrength ("Hlstrength", Range (1,Ten)) =1_lightdir ("Lightdir", vector) = (0,1,0,0) _lightcolor ("Lightcolor", Color) = (1,1,1,1)    }

We will take these 3 parameters to refrigerator the real light of these parameters, we can, the results such as:

We will find that this high-gloss effect is no different from the real light and will move with the character, and it is hard to imagine that this is not a real-time light

In order to effect obvious, deliberately to adjust the effect is too strong ...

Summary: We should use this way to do the time of the hand tour, see other games have light and shadow change efficiency is very high when also not surprised, and not necessarily the real-time lighting

This just simulates the parallel light, the principle of point light is also the same ...

Shader--The era of mobile-time

Related Article

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.