Forward Rendering Path

 

This page describes the details of the Forward   Rendering Path .

 

 The forward rendering path renders each object in one or more passes, depending on the lighting affecting the object. The lighting settings and intensity are different, and the lighting for forward rendering is also different.

 

implementation details

 

In forward rendering, some bright lights that affect the surface of the object will be rendered in fully per-pixel lit mode. Then, up to 4 point lights are computed per-vertex.

 

Other lighting is computed as Spherical Harmonics (SH), which is faster but is only an approximation. Whether a light is a per-pixel light depends on the following conditions:

 

  • Lights set to the Not Important render mode are always blended per-vertex or sphere.
  • Directional light is always pixel-by-pixel.
  • Lights set to the Important render mode are always pixel-by-pixel.
  • If the above result has fewer pixel lights than currently in the Quality Setting, then in order to reduce brightness, more lights will be rendered per pixel.

 The rendering process is as follows:

 

  • The basic Pass applies to a per-pixel directional light and all per-vertex (per-vertex) or spherically harmonic (SH) lights.
  • Other pixel lights are rendered in additional passes, one pass per light source.

For example, if some objects are affected by some number of light sources (as shown below, affecting A to H):


 

We assume that lights A through H have the same color, light intensity, and automatic rendering mode. These light sources will do a precise sorting of the object. The brightest light sources will be rendered from A to D in per-pixel lit mode.

 

 

Notice the overlap of light groups (between Per-Pixel, Per-vertex, SH). For example, the nearest pixel light is blended into per-vertex lit mode, so there is less light popping around moving objects and light sources.

 

Base Pass

 

Base Pass renders with a per-pixel directional light and all vertex or spherical harmonic lights (SH/vertex lights). This Pass will also be added to any lightmaps, ambient lights and directional lights emitted from Shaders.

 

The rendering of the directional light in this Pass has Shadows. Note that baked objects do not get light from SH lights.

 

When "OnlyDirectional" is enabled in the Shader's " Pass Flag " (tells the engine when and how they expect to be rendered to the engine), the forward Base Pass only renders the main directional light,

Ambient light or light probes (ambient/lightprobe), lightmaps (lightmaps) (spherical harmonic light and vertex lighting are not included in the Pass data).

 

Additional Passes

 

The rendering of extra passes is affected by the light per extra pixel of the object. The light source in this pass will have no shadows by default (so forward rendering supports a shadowed directional light) unless the Multi_Compile_fwdadd_fullshadows deformation shortcut is used.

 

performance considerations

 

The rendering speed of Spherical Harmonics lights is very fast. They have little overhead in the CPU and are easily accepted by the GPU (that's because the Base Pass calculates spherical harmonic lighting, but because of how SH Lights work, their overhead is the same no matter how many SH Lights there are).

 

The disadvantages of spherical harmonic lighting (SH Lights) are as follows:

 

  • They are calculated at the vertices of the object, not per pixel. This means they will not support light cookies or normal maps.
  • The frequency of SH Lights calls is very low, you can't do some significant overlighting with SH Lights. They also only affect Diffuse Light and are called very infrequently for specular/specular highlights.
  • SH Lights are not local, and point or spot SH lights close to the surface of the object look wrong.

In conclusion, SH Lights are often insufficient for small dynamic objects.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326390934&siteId=291194637