Unity3d Tutorial Shader: Nineth. Render Path

Source: Internet
Author: User

reprinted from the Wind Yu Chong Unity3d Tutorial College

Render Path definition
The Render Path is the light flow that is taken.


Render path Settings
Can be set in edit-> Project Settings->player, see. It can also be set directly in the Inspector panel of the camera.



Render Path detailed explanation

One: Vertex Lit
Vertex lit is the vertex light, as the name implies, is all the light calculation is at the vertex, so all the pixel operation effect is not supported, such as shadow, normal map, light cookies. An object generally has only one pass. Worst-performing, fastest running. Suitable for old equipment or general mobile devices.

II: Forward Lighting
Forward Lighting is based on shader. Supports pixel illumination (including normal maps and light cookies). Supports real-time shading of single-directional light. Usually the brightest (most environmental impact) light in the render mode Shang Important, corresponds to forward, the rest is Important with not, corresponding to vertex Lit.
Details:
(1) Brightest light source using pixel calculation
(2) second (up to 4) use vertex calculations. The remaining use
(3) Spherical harmonics (SH) calculation, it is a fast approximation algorithm.

Judging order
1.Render mode is definitely the vertex calculation or sh for not important.
2. The direction light with the highest luminance value must be a pixel calculation
3.Important is the pixel calculation.
If the number of lights does not reach the pixel light count set in quaility setting. The vertex or SH is converted to a pixel based on the luminance value.




Bass Pass: Renders the directional light for a pixel calculation. And all vertex calculations and sh directional light. Each additional pixel-wise light is then required to add a corresponding pass. Lightmap in this application, the direction light in this step can have a shadow.
Additional Pass: Extra pixel calculation light, no shadow. That is to say, forward lighting only supports a shaded directional light.

Sh:
Spherical harmonics, highly efficient, does not support light cookies and normal maps, slow update frequency, does not support specular reflection,


Three: Deferred Lighting
The Deferred Lighting gives the best results in light and shadows, with the highest performance requirements for the device. Requires Unity Pro. Mobile devices and Flash are not supported.
Details: Support, multiple light with real-time shading (e.g., the effect of multiple lights on players in football), does not really support anti-aliasing, does not support translucency. At least the shader Model 3.0. The illumination is calculated in the screen clipping space, so the complexity is based on the number of pixels involved, not the complexity of the scene model. Suitable for small-range light sources
Three stages:
Base Pass: Draws buffer information for clipping spaces such as depth buffers. stored in a ARGB32 Render texture, RGB has this point normal, a-mirror reflection intensity. If the depth can be read as texture, the depth will not be rendered explicitly. If it cannot be read, the shader is replaced with the shader replacement, which is camera.renderwithshader. The result of the Base Pass is that the scene object comes with a depth buffer and a texture that stores the normal and specular strength.
Lighting Pass: Only the Blinn-phong illumination model is supported, and the shadow is calculated in this step. Previously generated buffers are used in this step to calculate lighting. The resulting light buffer is also a ARGB32 Render texture,rgb table Diffuse light color, a-table monochrome mirror light.
Final Pass: Combines the texture color with the stored lighting results. Lightmap in this step is applied note: After this step of the deferred Lighting is completed, it will only go to forward Lighting.


Render Path Comparison Chart


Unity3d Tutorial Shader: Nineth. Render Path

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.