Unity3d surface shader (surface Shader) data integration

Source: Internet
Author: User

first, Shader surface shader syntax

The Unity surface shader (surface Shader) is a code generation method that uses it to write light shaders much easier than low-level vertex/pixel shader programs


Second, write a grayscale effect of the shader


third, the Shader built-in Shader normal-diffuse

Normal-diffuse is a simple illumination model, and the illumination intensity decreases with the decrease of the angle between the surface and the incident angle of light. The illumination intensity is only related to the incident angle and is not related to the camera.


Iv. Shader built-in Shader bumped diffuse learning

The bumped diffuse is based on the Lambert illumination model and uses the normal mapping technique to increase the surface detail of the object. The normal mapping does not change the shape of the object, but rather uses a special texture called normal Map to achieve this effect, relative to the way in which the surface details of the object are represented by increasing the split. In normal map, the color of each pixel represents the normal of the surface of the object on which the pixel is located, and then the light is calculated by this normal, rather than by the normals computed by the object model. It can be said that Normal Map "efficiently modifies" the entire model in the process of calculating illumination.


Five, Shader built-in Shader Vertex Lit learning

One of the simplest shader, all the light that shines on the object is rendered in a pass, and the light source is calculated only at the vertex. So there's no pixel-based rendering effect.


Six, Shader built-in Shader of specular learning

Specular uses the same lighting model as diffuse, but it adds a specular highlight associated with the observation angle. A light model known as Blinn-phong. The light model contains a reflective glare that is related to the surface angle of the object, the angle of incidence of the light, and the angle of the observer. In fact, the high-light method is a feasible simulation of the real-time light source fuzzy reflection. The fuzzy hierarchy is controlled by the shininess variable.


Vii. Shader built-in Shader bumped specular learning

The same light model as the specular, which uses an extra Tangent Space Normal Map texture map to describe the change of the object's surface normals and to increase the detail of the surface of the object compared to specular. In general, the cost of rendering this shader is relatively large.


Eight, Shader built-in Shader diffuse Detail learning

This is an ordinary diffuse shader plus some extra data on the shader. It allows you to define a second texture, called Detail Texture. As the Camera approaches, the Detail Texture gradually shows up, which is typically used for terrain. The Detail texture is overlaid on top of the main texture. A darker part of the Detail texture will darken the winner's texture, while the tint will brighten the main texture and the Detail texture is usually light gray. (unlike the Decal texture inside the Decal, the Decal texture is RGBA, Decal Texture is fused with the Main Texture through Alpha control, and the Detail texture is RGB, which is directly multiplied by the RGB channels of the two textures, respectively * *, that is, the Detail texture color value equal to 0.5 will not change the main texture color, greater than 0.5 will lighten, less than 0.5 will deepen)


Nine, Shader built-in Shader Parallax diffuse learning
Parallax Normal mapped is the same as the traditional normal mapped, but the simulation of "depth" is better. The extra depth effect is achieved through the height map. Height map is stored in the alpha channel of Normal map.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Unity3d surface shader (surface Shader) data consolidation

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.