Unity Rendering Basics

Source: Internet
Author: User
Tags creative commons attribution pack cpu usage substance painter

Unity renders base rendering 1. What is rendering?

All we can see is the need to render.
For example: Sky box, scene model, character model, special effects ...
If there is no rendering, the game world will be a piece of darkness.

2. Different versions render the difference

unity4.x: Rendering uses the Beast Technology of Autodesk;
unity5.x: Rendering uses the thing enlighten engine;
Unity5.6: The rendering uses the Enlighten engine, but there is an upgrade;

3. Mobile-Side rendering

Most of the models on the mobile side use two types of stickers as footage for rendering:
One is a diffuse map and one is a normal map.

4.PC host-Side rendering

PC host side (large-scale foreign single game) is mostly realistic simulation of the effect to render, using a lot of types of stickers (Unity's standard shader has 10 types of map support).
PBR: A physical rule-based rendering method.
GI: Global illumination, an algorithm for simulating complex behavior such as interaction and bounce of light .

Core points 1. Standard Shader

Two standard shaders (Shader) are available after unity5.x.
With these two shader we can render most objects.

2.Lighting Panel

The main thing is to set the light rendering in the scene uniformly.
Scene Light points: real-time and baked.

3. Reflective probe

Mainly used to implement the reflection of the model.

4. Light Probe Set

It is mainly used for the effect of model real time in baked scenes.

The importance of Shader1.shader

Shader is like a paintbrush and paint in the hands of a painter. If the painter does not have these two things, there is no way to draw a good work.
Everything you see in Unity is inseparable from Shader's rendering, whether it's sky boxes, scenes, character models, special effects .... These are the reasons why we can see them in the game, they can show a colorful virtual world, in which all the Shader are working.

Learning steps for 2.Shader
    • Unity built-in Shader use;
    • 3D Basic Mathematics learning;
    • Render steps for rendering pipelines;
    • Develop the Shader to meet your needs within Unity.
Sky box with built-in shader introduction 1. Color space Two color spaces:

Gamma Space: Mobile end, page tour, HoloLens, low performance hardware devices.
Linear Space: PC side, host side.

The Unity default color space setting option is selected as Gamma, but as
If we use the PBR rendering process (standard shader), we must modify the color space to Linear.

Modify Color space
Edit --> Project Settings --> Player --> Other Settings -->Rendering -->Color Space --> Linear
2. The role of Sky box Sky boxes
    • Used to render the display of the sky and surrounding environment;
    • As the auxiliary light source in the scene;

      Making Sky Boxes
    • Import "HDR environment map" footage image;
    • Modify the HDR map's "Texture Shape" to Cube;
    • Create a material ball, material ball select Shader for Skybox/cubemap;
    • Assigns the decal footage to the material ball.

      Using the Sky Box
    • The Skybox option on the Lighting panel sets the Sky box to use.
    • Drag the Sky box directly into the scene.

      Sky Box Material parameter adjustment
    • Exposure: Adjusts the brightness of the map.
    • Rotation: Rotate the map, many times the map has the sun, we can rotate to let the map of the sun and the scene in the direction of light overlap.

      Built-in Shader

      Unity's built-in Shader can be divided into three groups, with different roles and applications:

1.unity5.x New Shader
2.unity5.x Standard Shader (for PBR rendering)
3.unity4.x Legacy Shader (used to support rendering of legacy projects)

Standard shader four modes of rendering 1. Four rendering modes 1.Opaque (opaque)

Function: Used to render all opaque objects, such objects are the most in the scene. Ratio of 60%.

2.Cutout (Hollow)

Function: Used to render an object with a skeleton, such objects are not too many in the scene. Ratio of 5%.

3.Fade (looming)

Function: Used to render the realization of the object's fade and fade. There are not many such objects in the scene. Ratio of 5%.

4.Transparent (Transparent)

Function: Used to render objects with transparent effects, such objects are also more in the scene. Ratio of 30%.

2. Standard Shader function layout 1. Render Mode Area

When a material ball is created and the Shader is set to a standard shader, the first step is to set different rendering modes based on the properties of the object to be rendered by the material ball (opaque objects, transparent objects).

2. Main map Area

Used to set the primary map for Shader, which controls the final rendering of the model using the map and settings of this area. 80% of the model, we just need to set the location of the map is enough.

3. Secondary map Area

The secondary map used to set the Shader to add details to the model. Setting items in this location are not normally used. However, some models that require close-up observation, set up the main map above, and then set the secondary map below, can increase the refinement of the model.

Ten mapping types for standard Shader 1. Standard Shader birth 1. Background understanding
    • In the unity4.x phase, unity was compared to urealengine (unreal), and the conclusion was that unity was "slag quality" and Ureal was "tall." But unity is relatively easy to learn, development speed, multi-platform, more jobs, but also ureal.
    • The unity4.x phase of screen rendering uses AutoDesk's Beast technology, and the unity5.x phase completely abandons Beast technology, instead using a third-party rendering engine urealengine like enlighten to render the picture.
    • Unity has introduced "standard Shader" to complement this new rendering engine.
    • Theoretically, we can use Unity5 to produce the same picture effect as the urealengine.

      2. Advantages of Standard Shader

      Use a Shader to perform most of the rendering of the scene model, whether character, metal, plastic, leather, fabric, glass, construction ... can use a standard Shader to complete rendering.

      3. Standard Shader Map

      Standard Shader uses PBR rendering, rendering representations based on realistic physical effects. Whether a model can be rendered using standard Shader is determined by the mapping of the model. Whether or not it is made according to the production specifications and patterns of the PBR map determines if the model can be rendered using standard Shader.

2. Common stickers Introduction 1. Two Standard Shader

There are two standard Shader in the unity5.x:
Standard: normal shader
Standard (Specular setup): normal shader (mirror)

2.Albedo Map

Albedo: albedo [map]; used to reflect the texture and color of the model.

The albedo map itself is a map of color and texture.

This option has a map property and a color attribute.

Two attributes can be used alone or in combination;

When the color attribute is pure white, it does not affect the effect of the map;

Overlay the map effect when the Color property is a different color.

3.Metallic Map

Metal degree [decal]; used to reflect the model of the high-gloss metal reflection;

The metal map itself is a gray figure, the whiter the place, the more intense the metal, the darker the place the lower the degree of metal.

Smoothness: Degree of smoothness

A value between 0 and 1, the smaller, the lower the smoothness, the greater the smoothness, the higher the degree.

4.Normal map Map

Normal map: normal map; To increase the details of the model;

The normal map itself is a blue bump map.

5.Occlusion Map

Occlusion:ao map;

The AO map itself is a gray figure.

Mainly used to improve shadows, give more depth to the scene (model), and help to better represent the details of the model.

6.Specular

Specular: Mirror [decal], similar to the "metallic metal" map.

The PBR map is made in different ways, and eventually there are two types of stickers, metallic and specular, about the performance of the "Metal part".

7.Detail Albedo x2

Detail Albedo x2: Detail albedo [map];

The function is a detailed expression of the main Albedo map;

8.Normal Map x2

Normal map x2: detail normal [map];

The function is a detailed representation of the main Normal map map;

9.Detail Mask

Detail Mask: Detail mask [decal];

This map is used in conjunction with the Detail albedo,normal map two map in the secondary map area, where the two tiles in the secondary map area are tiled, and the effect is used for all of the models, and we use Detail Mask to do something that does not need to be "sub-mapped" The affected part is independent.

10.Emission Map

Emission: self-luminous [map], let model spontaneous light;

In addition to lighting components and Sky boxes, unity can be used as a light source, and the emission map inside the standard shader can also be used as a light source.

11.Height map Map

Height map: Parallax [map], more stereoscopic than normal map a way of mapping;

Mainly used for the surface, building and other effects of the embodiment.

PBR effect
    • 3dmax/maya Making model White mold
    • substance Painter making PBR stickers
    • unity5.x for synthetic use
PBR Textured Metal Material 1. The importance of the degree of metal

In unity5.x, the degree of metal is one of the most important adjustable parameters.

We simulate real-life things in Unity, and many times we need to control their degrees of metal.

2. Code modification Shader parameter 1. Shader Source code Download

Unity is not the only update unity that will be updated every time the version is renewed, and the accompanying resources will be updated, such as the Shader source code for the version. [See photo]

2. Related APIs

Gets the value of the parameter in Shader:

material.GetFloat(" 参数名 "); //获取小数类型值material.GetColor(“参数名”); //获取颜色类型值;  material.GetTexture(“参数名”); //获取贴图类型值;

To modify the value of a parameter in Shadder:

material.SetFloat(“参数名”,值); //设置小数类型值;  material.SetColor(“参数名”,颜色值); //设置颜色类型值; material.SetTexture(“参数名”,贴图); //设置贴图类型值;  
2. Summary of metals 1. Two parameters

The metallic has two parameters, the map and slider bar, and the slider bar controls the parameter is 0~1.

A metallic map is a black-and-white image that uses these black-to-white colors to store 0~1-related information values.

slider bar is the whole of adjustment, when adjusting, the whole model is a unified effect;

The map can control the high and low degree of metal, which makes the model metal effect more layered.

PBR Texture Performance Glass Texture two parameters

The Albedo has two parameters, a map and a color panel, and the Alpha channel inside the color palette is 0~255.

A Albedo map is a solid-color texture map that can have an Alpha channel.

Color panel inside the Alpha channel, adjust the time, the whole model is a unified effect;

Map can control the transparency of the high and low, so that the model transparency effect is more hierarchical.

Post-screen rendering effects 1. Post-screen rendering effects 1. Concept Introduction

Post-screen rendering effects, also known as camera effects.

The post-screen rendering effect is a special effect used in the post-processing of our game screen, and is played on the camera game object in the game scene.

For example, in real life photographers take photos:

① Persona makeup is like we use the Shader material to beautify the model in Unity;

② a variety of auxiliary lights like Unity in the lighting system, creating an atmosphere;

③ after taking pictures, and later also need to use PS production modification of some places, this step of the operation, in our game development process corresponds to "post-screen rendering effects."

2.imageeffects1.imageeffects Introduction

Imageeffects is one of the resource bundles included with Unity, which contains a large number of camera effects, and the camera-specific scripts can only be mounted on the camera for use.

The resource pack import steps are as follows:

Project panel Right-click-->import package-->effects

2. Precautions

① Camera Effect Resource Pack import, Component the last item will appear the "Image Effects" option, through this menu, you can add the corresponding effects to the selected camera game objects.

② all the special effects in this camera special resource bundle, divided into nine categories [see pictures], more than 30 special effects scripts.

③ camera effects are allowed to overlay, which means that we can use multiple post-screen rendering effects in a reasonable combination on the camera.

④ In addition, Unity's resource store also has a large number of third-party post-screen rendering effects resources.

3. Scene beautification Case 1. antialiasing[anti-aliasing effect]

Location: Image Effects-antialiasing

3D model objects rendered by computer graphics, the edges of objects will appear jagged, affecting the visual experience. You can use anti-aliasing effects to balance these jagged edges.

Technique: antialiasing algorithm, there are seven types of algorithms available to choose from.

2.bloom[pan-Light effect]

Location: Image Effects-Bloom and Glow-Bloom

Pan light is an enhanced glow, halo effect.

Mode: pattern, base mode, and complex mode.

Threshold: A threshold that controls the range of the flood light.

3.Screen Space Ambient obscurance[screen spatial environment AO effect]

Location: Image Effects-Rendering-screen Space AO

You can simulate the ambient occlusion effect in a scene in real time.

4.Noise and scratches[noise and scratches effects]

Location: Image Effects-Noise-Noise and scratches

Add noise and scratches to the scene effect, which can be used to simulate the picture effect of an old movie.

Unity5.6.0 New Rendering features introduction 1. Standard Shader Update 1. Emission parameters

Version 5.5.1: The properties of the emission map are directly displayed on the panel;

5.6.0 version: Emission map You need to tick "check box" to show the relevant properties.

2.Advanced Options Area

5.6.0 has added a new advanced options (premium) area to 5.5.1.

2.Lighting Panel Update 1. Version Update comparison

Ambient light area: The new and older versions are consistent and unchanged.

Live Rendering Area: Older versions have parameters for rendering resolution and CPU usage, and the new version removes both parameters.

Bake render area: The new version extracts the baked (illuminated map) parameters separately into a new area, lightmapping Settings. The overall parameter is almost identical to the old version.

3.Light Explorer new Feature 1. Light Explorer [lighting Manager]

Gives a unified control and management panel for lighting, reflection probes, light probe sets, static spontaneous light objects in the scene.


This work is licensed by Star Meteor Chen using the Creative Commons Attribution-NonCommercial 4.0 International license Agreement.

Unity Rendering Basics

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.