Unity | HDRP high-definition rendering pipeline study notes: HDRP lighting system

Table of contents

1. Light component

1. Angular Diameter

2. Light Appearance

3. Intensity (light intensity)

4. Indirect Multiplier

5. Volumetrics

6. Shadows

6.1 Shadow Map (shadow map)

6.2 Contact Shadow (contact shadow)

Two, Reflection Probe component (reflection probe)

1. Type (how the reflection map is generated)

3. Light Probe Group component (light probe group)

4. Lightmap Baking

1. Lightmap baking technology

2. Specific baking operation

五、Volume Override

1. Shadows

1.1 MaxDistance

1.2 Working Unit

1.3 Transmission Multiplier (optical transmission multiplier)

1.4 Cascade Count (shadow cascade number)

2. Contact Shadows

 2.1 Length

2.2 Opacity (transparency)

2.3 Quality

3. Micro Shadows

4. Ambient Occlusion

4.1 Intensity

4.2 Direct Lighting Strength

4.3 Radius (radius range)

4.4 Temporal Accumulation

4.5 Ghosting Reduction


1. Light component

1. Angular Diameter

        Use this option to control the intensity of the highlights of the parallel light on the object and the softness of the shadows

2. Light Appearance

        HDRP will use the two parameters of Filter and Temperature to calculate the final color of the light emitted by the light source. The higher the color temperature, the more blue it will be; otherwise, the more yellow it will be. When the color temperature is greater than 5000 (unit is kelvins, expressed as K), it is usually called a cool color; otherwise, it is called a warm color.

3. Intensity (light intensity)

        Light intensity is used to control the brightness of the actual sun light

4. Indirect Multiplier

        (Note: If the Baked Global Illumination option is not enabled in the Window→Rendering→Lighting Settings interface, this parameter is invalid.)

  1. Set it to 1 for simulating real world lighting. (A side effect is that the indirect lighting may be too strong, resulting in distortion of the picture.)
  2. If set to 0, then this light will not generate indirect lighting information in the scene.

5. Volumetrics

        This parameter is used to simulate the phenomenon that the light emitted by the light source is scattered through the volumetric fog.

6. Shadows

6.1 Shadow Map (shadow map)

  • Resolution

        It is used to control the quality of the shadow. The higher the quality, the better the shadow effect. Of course, it will also increase the burden on the GPU and the memory usage, which may cause performance problems.

6.2 Contact Shadow (contact shadow)

        There is no option to adjust contact shadows in the settings of the parallel light component or in the HDRP configuration file. At this time we will use the Contact Shadows property in the Volume.

Two, Reflection Probe component (reflection probe)

1. Type (how the reflection map is generated)

  1. Baked (generate reflection maps in a baked way)
  2. The Custom (custom) method allows you to specify a Cubemap as a reflection map (can be used to make special effects).
  3. The Realtime (real-time generation) method can provide more accurate reflection maps, but because it is calculated in real time, the performance is poor.

3. Light Probe Group component (light probe group)

        The role of the lighting probe group is to bake the indirect lighting information in the scene (that is, when the direct light hits the surface of the object in the scene, the lighting information obtained when the light collides with the object and bounces) to the light probe. on the needle. When the game is running, the dynamic objects in the scene walk in various areas of the scene. Although dynamic objects cannot participate in lighting baking (only static objects can participate in lighting baking calculations), they can provide themselves with more realistic surface lighting effects by sampling the indirect lighting information on these light probes.

        Light probes are considered to be a low-cost, high-performance solution for providing indirect lighting information and generating dynamic shadows for dynamic objects.

        The baking of the light probe group is not like the reflection probe that can be baked through the bake button on the component. The baking of the light probe needs to be completed by using the Lighting baking interface and the light map of the scene at the same time.

4. Lightmap Baking

        How to simulate indirect light in Unity? There are two methods:

  • Lightmap baking (Lightmapping).
  • Realtime Raytracing (Realtime Raytracing): depends on hardware.

1. Lightmap baking technology

        The lightmap baking technology developed by Unity is called "Progressive Lightmapper". Progressive Lightmapper has two versions: CPU version and GPU version. Of course, the GPU is preferred for a simple reason: the baking speed is fast. The baking speed of the GPU version is generally about 10 times faster than that of the CPU. The premise is that the video memory on the GPU is sufficient to support the entire baking process; if the video memory is not enough, the system will automatically switch to the CPU version to continue baking, and the baking speed will be significantly reduced at this time.

2. Specific baking operation

(1) The object is set to Static

(2) Lighting lighting baking window settings

        (a) Window→Rendering→Lighting Open the lighting baking window

        (b)Mixed Lighting

        To bake global illumination, you must check the Baked Global Illumination (baked global illumination) option here, and then select a lighting mode: Baked Indirect or Shadowmask.

        The difference between Shadowmask and Baked Indirect is that in addition to baking indirect lighting information, the former also bakes shadows in Lightmap (light map). Shadowmask mode can provide the most realistic shadow effect, of course, the performance consumption and memory usage are also high. Shadowmask mode is suitable for scenes with visible objects in the distance, such as open world games running on high-end machines.

        (c)Lightmapping Settings

  • Lightmapper: You can choose Progressive GPU or Progressive CPU, and the GPU version is preferred.
  • Direct Samples, Indirect Samples and Environment Samples: used to set the sampling value. The larger the sampling value, the more detailed the lightmap, and the correspondingly longer baking time.
  • Bounces: Used to control the number of bounces of rays when performing ray tracing calculations. The more bounces, the more detailed the lightmap, and the correspondingly longer bake time.
  • Filtering: Under Filtering, you can choose a Denoiser (noise reduction algorithm). Different noise reduction algorithms can be selected for Direct Denoiser, Indirect Denoiser and Ambient Occlusion Denoiser respectively. The general recommendation is to choose the same noise reduction algorithm for these three items according to different platforms. For example, choose Optix for Nvidia graphics cards; choose Radeon Pro for AMD graphics cards. OpenImageDenoise from Intel is a CPU-based denoising algorithm available for all platforms.
  • Lightmap Resolution: This value is used to control the resolution of the lightmap. The higher the resolution, the more detail the lightmap has and the longer the baking time. Generally, when you first start testing baking lightmaps, you can try to set it to 20 or 30, and then gradually increase until you can obtain satisfactory lightmap details in a reasonable baking time.
  • Lightmap Padding: Used to control the size of the interval between the lightmap areas separated by UV in the lightmap. If this interval is too small, there is a risk of color bleeding at the edges of the lightmap. However, if the interval is too large, the lightmap space will be wasted and the number of textures will be increased, resulting in an increase in the memory usage of the lightmap.
  • Lightmap Size: Used to control the maximum size of each lightmap.

        (d) Auto Generate: Generally, this option is not checked during official baking. If the scene is small or the hardware is good (for example, the development computer is equipped with a graphics card with large memory), you can enable this option during the experimental baking phase. In this way, Lightmapper will automatically bake every time you modify the value of a component in the scene or move, rotate, or scale an object.

        (e) Generate Lighting: When all parameters are set, click this button to start baking.

(3) Enhance indirect light intensity: Indirect Lighting Controller (Volume Override)

(4) Dealing with shadows and ambient light occlusion

五、Volume Override

1. Shadows

1.1 MaxDistance

        For different types of light sources, the functions of the Shadows property are as follows.

  1. For Punctual Light (accurate light source type), use the Max Distance (the farthest shadow projection distance, in m) parameter to control the furthest distance that this type of light source casts shadows (after this distance, shadows will no longer be rendered). (Precise light source type: a light source that emits light from a point, in Unity it is a spotlight (Spot Light) and a point light source (Point Light)).
  2. For the parallel light type, the Max Distance parameter is used here to control the furthest display distance of the Shadow Cascade (shadow cascade) (after this distance, the shadow will no longer be rendered)

1.2 Working Unit

        The specific unit used to set the value of Split and Border.

  1. If set to Metric, HDRP will use m as the unit;
  2. If set to Percent, HDRP will use percentage values.

1.3 Transmission Multiplier (optical transmission multiplier)

        The value is 0~1. Can be used to control the multiplier applied to the light intensity when a directional light hits a thick object.

1.4 Cascade Count (shadow cascade number)

        The value is an integer from 1 to 4. Respectively represent a minimum of 1 cascade and a maximum of 4 cascades. After setting it to a different number of cascades, the number of Split and Border input values ​​below will change accordingly. For example, if 4 cascades are set, 3 Split input values ​​and 4 Border input values ​​will appear below.

2. Contact Shadows

        Because the contact shadow algorithm is based on the screen space, it can only sample the data of the current screen for the calculation of the contact shadow. Therefore, when using the contact shadow, it needs to be adjusted slightly, as a supplement to the main shadow, not Let the contact shadow become the protagonist of the shadow in the picture.

 2.1 Length

        It is used to control the length (in m) of the rays used by the Raymarching algorithm. This also represents the longest distance a ray can capture detail for shadow calculations.

2.2 Opacity (transparency)

        Used to control the transparency of the shadow itself.

2.3 Quality

        Used to control the quality of shadows. The higher the quality, the larger the number of samples, and the greater the corresponding performance consumption. If Custom is selected here, we can customize the Sample Count (number of samples).

        Contact Shadows will only work on the "main light source" in the current scene. So how does HDRP determine which light source in the scene is the main light source? There are the following two judgment methods.

  1. There is no parallel light (Directional Light) in the current scene: HDRP judges which light’s bounding box (Bounding Box) size occupies the largest proportion on the screen in the current scene, then the light with the largest proportion is the main light source . It is also the only light in the entire scene that casts contact shadows.
  2. If there is a parallel light in the current scene: No matter what other light sources are in the scene, this parallel light is the main light source. In this case only directional lights will cast contact shadows.

3. Micro Shadows

        The parameters of the micro shadow are very simple, an Enable switch and Opacity (transparency) parameter, which is used to adjust the transparency of the shadow.

        Micro Shadows will use the Normal Map (normal map) and the Ambient Occlusion Map (ambient occlusion map) on the material to calculate the tiny shadows on the surface of the object. HDRP does not use mesh surface data to calculate micro-shading. Note that using Micro Shadows will increase performance consumption.

4. Ambient Occlusion

        Ambient Occlusion (ambient occlusion), referred to as AO. Ambient occlusion is also calculated based on screen space, so there will be edge display problems similar to Contact Shadows. Therefore, when using ambient light occlusion, in principle, the effect should not be adjusted too obviously, but mainly auxiliary.

4.1 Intensity

        Used to control the display effect of ambient occlusion. The higher the value, the stronger the effect and the darker the area it affects (wall corners, cavities, etc.).

4.2 Direct Lighting Strength

        Used to control the intensity of ambient occlusion for areas receiving direct light. The larger the value, the darker the area.

4.3 Radius (radius range)

        Used to control the range of HDRP searching for occlusions in screen space. The larger this value, the larger the area where ambient occlusion is active, but the display quality may be reduced.

4.4 Temporal Accumulation

        After enabling this option, you can use the previously generated frames to get better results when calculating AO (you need to enable Motion Vectors support in the camera's Custom Frame Settings). However, there may be a ghosting effect (Ghosting) in the process. To reduce the ghosting effect, we will use the next setting.

4.5 Ghosting Reduction

        The closer the value is to 0, the more severe the ghosting, but this can reduce the noise in the picture due to the use of Temporal Accumulation; on the contrary, the closer the value is to 1, the less obvious the ghosting effect, but the more serious the noise will be. We choose 0.5 as a compromise.

Guess you like

Origin blog.csdn.net/weixin_39766005/article/details/131082169