Unity | HDRP high-definition rendering pipeline study notes: Volume

Table of contents

1. Volume framework

2. Volume Profile

3. Volume overloading

1.Visual Environment (environment settings)

1.1 Sky type

1.2 Ambient Mode

2.Sky

2.1 HDRI Sky (HDRI Sky)

2.2 Gradient Sky

2.3 Physically Based Sky

3. Exposure (screen exposure)

3.1 Mode

3.2 Metering Mode

3.3 Limit Min and Limit Max

3.4 Compensation

3.5 Adaptation

4.Fog (fog effect production)

4.1 Fog (global fog effect) in the Volume component

4.2 Local Volumetric Fog (local fog effect)

5.Material (material)


1. Volume framework

        The Volume framework is one of the most important components of HDRP. The role of the Volume framework is summarized as follows:

  • Sets ambient lighting from the skybox for the scene.
  • Set various shadow effects, including Contact Shadow and Micro Shadow in the scene.
  • Sets the fog effect in the scene.
  • Set reflection and refraction based on screen space (Screen Space Reflection and Screen Space Refraction), ambient light occlusion (Ambient Occlusion).
  • Set the post-processing effect (Post-processing).
  • Set up real-time ray tracing (Ray Tracing).

        The mode of each Volume can be set to Global (global) or Local (local) as needed:

  • Global mode means that this Volume is effective for the entire scene. Regardless of where the camera is facing, the Volume in Global mode will be counted.
  • The Volume in Local mode only takes effect within the scope of its Collider. After selecting the Local mode, the Add Collider button will appear on the interface, and you can click this button to add a collider to the current Volume. Generally we use the Box Collider with the best performance. Of course, other types of colliders can also be used if there are special needs.

        The global Volume always affects the camera in the scene, while the local Volume will only affect it when the camera enters the set Collider range.

2. Volume Profile

        To make the Volume component effective, it needs to add a Profile (configuration file). The essence of Profile is a Scriptable Object, which does not have any special functions, but is just a place to save configuration data.

        A default Volume Profile is already included in the menu Edit→Project Settings→HDRP Default Settings. If you don't set any Volume in the scene, then this default Volume will work. Therefore, the attributes of Volume added in the scene are called Override (overload).

3. Volume overloading

        Click the Add Override button in the Volume component to see that the current Volume overloads are divided into 9 categories (this list is not fixed, as the HDRP version is upgraded, the content inside will become more and more abundant).

1.Visual Environment (environment settings)

1.1 Sky type

        You can choose None, Gradient Sky, HDRI Sky and Physically Based Sky four sky types in Sky type.

  1. None: This Volume will not render a skybox.
  2. Gradient Sky: Divide the rendered sky into high, medium and low layers, and you can assign a color to each of these three layers.
  3. HDRI Sky: Uses a Cubemap (cube map) to render the entire sky.
  4. Physically Based Sky: Used to simulate the sky of a spherical planet. The atmosphere of the sky has two parts. As altitude decreases, the air density of the atmosphere decreases exponentially.

1.2 Ambient Mode

        You can choose Static and Dynamic two modes.

  1. Static (static mode): In static mode, the ambient light of the entire scene comes from the baked Sky ambient light. The ambient light can be set using the Static Lighting Sky property in the Lighting window.
  2. Dynamic (dynamic mode): In dynamic mode, the ambient light of the entire scene comes from the Sky ambient light set in Visual Environment, which allows us to dynamically change the ambient light in the current scene.

2.Sky

        The type of Visual Environment overload in the Volume component is set to three sky types: Gradient Sky, HDRI Sky and Physically Based Sky:

2.1 HDRI Sky (HDRI Sky)

        If you set Sky as HDRI type in Visual Environment, you need to add the overload of HDRI Sky and make specific settings.

  • Hdri Sky

        Specify a Cubemap for rendering the sky.

  • Intensity Mode

        It is used to control the intensity of ambient light from the sky. There are three modes to choose from:

  1. Exposure: Calculate the brightness of the sky using a value with a unit of EV100.
  2. Multiplier: Use a fixed multiplier to control the brightness of the sky.
  3. Lux: Calculates the brightness of the sky using a value in Lux.

        Lux lighting unit: The lighting information represented by this unit only has direction information and no intensity attenuation information, which means that this unit is suitable for representing sunlight, which has only angle changes and no intensity changes for the earth.

  •  Rotation (rotate HDRI texture):

        Drag the slider to rotate the Cubemap to change the sky display within the visible range of the current camera.

  • Update Mode:

        There are three update modes to choose from:

  1. On Changed: Updates when one or more sky-related parameters change.
  2. On Demand: Only when triggered by the API in the script will it be updated.
  3. Realtime: Automatically update according to the interval specified in Update Period.

2.2 Gradient Sky

  • Top, Middle and Bottom

        Used to control the color of the upper half of the atmosphere, the color of the horizon, and the color of the lower half of the atmosphere (the part below the horizon), respectively.

  • Gradient Diffusion

        Used to control the size of the color coverage area (Middle) of the horizon part, divided into two cases:

  1. The value is greater than 0, and the default value is 1. If set to 0, the color of the horizon part covers the entire sky; the larger the value, the smaller the color coverage area of ​​the horizon part (this part of the atmosphere looks thicker).
  2. The value is less than 0, if the value is less than 0, the colors of the Top and Bottom areas are swapped. The lower the value, the smaller the area covered by the color of the horizon (this part of the atmosphere appears thicker).
  • Intensity Mode

        You can choose to use Exposure (the unit is EV100); you can also choose to use a fixed multiplier value.

2.3 Physically Based Sky

        Physically based skies are not only suitable for creating terrestrial environments, but alien environments as well.

  •  Planet Center Position

        Since the diameter of the earth is about 12742km, set the Y-axis value here to -6378100m.

  • Ground Color Texture

        Used to control the texture of the planet's surface.

  • Ground Tint

        Used to tint the Ground Color Texture.

  • Ground Emission Texture

        Texture used to control the self-illuminated portion of the planet's surface.

  • Ground Emission Multiplier

        Multiplier applied to the Ground Emission Texture.

3. Exposure (screen exposure)

        Exposure refers to the intensity of light received by the camera's sensor. The higher the exposure value, the greater the intensity of light received by the camera. After setting up Sky, you need to adjust the entire picture seen by the current camera by controlling the Exposure reload.

        Because HDRP is a completely physically-based rendering system, all lighting settings and material settings are based on physics, so if you want to display the scene picture normally, you must set the correct exposure for the scene.

        If a Volume has an Exposure overload added, all cameras affected by the current Volume will use this Exposure overload and be affected by it. This exposure affects the final effect displayed in the current Camera window.

3.1 Mode

        The Exposure overload in Volume contains five modes: Fixed, Automatic, Automatic Histogram, Curve Mapping, and Use Physical Camera. ​​​​

Fixed (fixed exposure)

Using a fixed value to control the exposure, this mode can be used in scenes where the exposure does not vary much.

HDRP's lighting system is completely based on physics, so it can refer to the real exposure value of the physical world. (See the value of EV100 in the figure above)

Automatic

Automatically adjust the scene exposure according to the current camera position information and related scene information. Ideal for scenes where exposure varies from position to position.

Automatic Histogram

In this mode, the system will automatically adjust the exposure value according to the brightness distribution in the scene. By analyzing the histogram information in the scene, the system adjusts the exposure value according to the brightness range and contrast.

Curve Mapping (curve controls exposure)

Use curves to control the exposure of the scene. The X-axis represents the exposure of the current scene, and the Y-axis represents the exposure we want. The method of curve control is generally left to the experts in the field.
Use Physical Camera (physical camera controls exposure) The properties of the physical camera are in the Camera component. If this option is selected, only Compensation (compensation) is left in the Volume interface. (The advantage of using a physical camera is that if you are familiar with various camera parameters in the real world, you can use your existing knowledge to precisely control the exposure of the picture)

3.2 Metering Mode

        Used to control how the lights in the scene are sampled for exposure calculations, there are five modes to choose from:

Average Sampling is performed on the entire screen, and the calculation result is very stable.
Spot (spot metering) Only the area in the center of the screen is sampled, and the calculation results are not stable. If the sampled area in the center of the frame is dark, the entire frame may be overexposed; otherwise, it may be underexposed.
Center Weighted Take advantage of the former two. The camera will add a weight to each pixel in the frame, the most central pixel has the highest weight, and the farther away from the center, the lower the weight. Finally, the exposure is calculated according to the weight of each pixel.
Mask Weighted This mode uses masks to define the weights of different areas. Users can create masks and adjust the metering weight of different areas according to the mask's properties such as intensity or color.
Procedural Mask This mode uses procedurally generated masks to define weights for different areas. Users can generate procedural masks using code or shaders, and adjust metering weights based on the generated masks.

3.3 Limit Min and Limit Max

        These are used to control the minimum and maximum values ​​of the scene's auto exposure, respectively. These two values ​​can be used to adjust the overall exposure when the camera is in the dark and bright parts of the scene, respectively.

3.4 Compensation

        Similar to the setting on many cameras, it is used to compensate the exposure obtained by automatic calculation. If you want to get overexposed or underexposed effects, you can use this parameter to control. Normally set to 0.

3.5 Adaptation

        It is used to control the change speed of the picture exposure when the picture changes between light and dark, that is, when the picture changes from dark to light or from light to dark. The following options are available:

  1. Fixed (fixed): HDRP fixed way, no need to input any parameters.
  2. Progressive (gradient): You can set the value of Speed ​​Dark to Light (from dark to light change speed) and Speed ​​Light to Dark (from light to dark change speed). The larger the parameter value, the faster the exposure will change.

4.Fog (fog effect production)

        If you want to make a volumetric fog effect (Volumetric Fog), first make sure that you have turned on Volumetric Fog under Lighting in the HDRP configuration file used by the current project.

  • Fog in the Volume component: suitable for making global fog effects.
  • Local Volumetric Fog under GameObject→Rendering in the top menu (need to be used in conjunction with Fog): suitable for making local fog effects, such as clouds floating in the air.

4.1 Fog (global fog effect) in the Volume component

  • Fog Attenuation Distance

        It is used to control the visibility of the fog, and the value unit is m. If set to 10m, it means you can only see 10m away from your current location.

  • Base Height

        It is used to control the boundary height of continuous fog effect and exponential fog effect. (eg: Setting the value of the Base Height parameter to 2m means that in the space 2m upwards from the floor, the fog is continuous without attenuation; starting from the height of 2m upwards, the fog will start to display in an exponential decay manner.)

  • Maximum Height

        It is used to control the highest height of fog that can be displayed. At this height, the fog concentration will drop to 37% of the bottom fog concentration.

  • Max Fog Distance (fog effect maximum distance)

        This maximum distance is from the current camera. Fog will no longer be rendered after this maximum distance is exceeded. It is recommended to set this distance higher than the Clipping Planes→Far value in the camera component to prevent the fog on the skybox from appearing inconsistent with the fog on objects in the scene.

  • Color Mode

        Used to control the color of the fog:

  1. Constant (unchanged color): that is, use a single color;
  2. Sky Color (sky color): This color is suitable for use in a scene with a sky box added. HDRP will sample the color of the sky to control the color of the fog.

        In Sky Color mode, there will be an additional Tint option. The color in Tint will be multiplied with the sky color (Multiply), so this color will not greatly change the color of the fog.

  • Volumetric Fog

        If you want the scene to have the effect of volumetric fog or the so-called "God's light" effect, you need to turn on this option. Note that the effect of volumetric fog consumes more performance, so pay attention to the actual performance consumption when using it, depending on the situation.

  • Albedo (Albedo)

        Used to control the overall color of the fog. However, when simulating the real world, we generally do not adjust the color of the fog itself (the fog itself has no color), because the fog reflects the color of the sky and ambient light.

  • Ambient Light Probe Dimmer

        Use this parameter to adjust the ambient light intensity from the sky. The larger the value, the brighter the fog in the scene, and vice versa.

4.2 Local Volumetric Fog (local fog effect)

  • Single Scattering Albedo

        Used to control the color of the fog.

  • Fog Distance

        Used to control the density of fog.

  • Size

        Used to control the length, width and height of the cuboid.

  • Blend Distance

        The edge of the fog can be faded, so that the fog does not appear to be contained in a cuboid.

  • Density Mask Texture

        Moving animations are possible.

  1. Specify a Texture3D resource for it as an input to adjust the Scroll parameter to make the fog move.
  2. The values ​​of Scroll X, Y, and Z can be set so that the fog will move along the movement direction calculated by using the three values.
  3. The thickness of the fog can be increased in the corresponding direction by adjusting the Tiling parameter.

5.Material (material)

        In HDRP, Diffusion Profile is used to save the configuration information of Subsurface Scattering. To apply these Diffusion Profiles to the associated Subsurface Scattering material, they need to be added to the HDRP profile first.

         HDRP allows 15 Diffusion Profiles to be used simultaneously in the same scene.

        If some Diffusion Profiles are only applied in some scenes, we can also only add these Diffusion Profiles to the Diffusion Profile Override in the Volume component of the current scene, so that they do not need to be added to the HDRP configuration applied to the entire project file. The advantage of this is that it can reduce the performance consumed by finding the correct Diffusion Profile during rendering. This is especially useful for scenes containing a lot of vegetation, because usually such scenes will have a lot of repeated drawing (Overdraw).

Guess you like

Origin blog.csdn.net/weixin_39766005/article/details/131055470
Recommended