Rasagar/Library/PackageCache/com.unity.render-pipelines.high-definition/Documentation~/skin-and-diffusive-surfaces-subsurface-scattering.md
2024-08-26 23:07:20 +03:00

4.3 KiB
Raw Blame History

Skin and diffusive surfaces (subsurface scattering)

Subsurface Scattering handles light that penetrates and moves within the area under a surface. Use it to make organic materials, like skin, look smooth and natural rather than rough and plastic-like. HDRP implements subsurface scattering using a screen-space blur technique.

Subsurface scattering also handles the light that penetrates GameObjects from behind and makes those GameObjects look transparent. For certain types of objects, the screen-space blur effect may not make a large visual difference. Therefore, HDRP implements two material types:

  • Subsurface Scattering implements both the screen-space blur effect and transmission (you can disable the latter).
  • Translucent only models transmission.

Enable Subsurface Scattering

To enable subsurface scattering in your HDRP Asset:

  1. In the HDRP Assets Inspector window, go to the Material section and enable the Subsurface Scattering checkbox.
  2. When you enable the Subsurface Scattering checkbox, HDRP displays the High Quality option. You can Enable this option to increase the sample count and reduce the amount of visual noise the blur pass can cause by under sampling. Note that this is around two and a half times more resource intensive than the default quality.
  3. Go to Edit > Project Settings > HDRP Default Settings and, in the Default Frame Settings section, under the Lighting subsection, enable Subsurface Scattering and Transmission.

HDRP stores most subsurface scattering settings in a Diffusion Profile. HDRP supports up to 15 custom Diffusion Profiles in view at the same time, but you can override which Diffusion Profiles HDRP uses and thus use as many Diffusion Profiles as you want throughout your project. To do this, use the Diffusion Profile List in the Volume system. This override lets you specify 15 custom Diffusion Profiles which HDRP can use for a Camera within the override's Volume.

To create a Diffusion Profile, navigate to Assets > Create > Rendering > HDRP Diffusion Profile. For HDRP to detect it, you must add it to the Diffusion Profile List of the Diffusion Profile List Component in an active Volume.

Refer to Diffusion Profile reference for more information.

Add subsurface scattering to a Material

To add subsurface scattering to a Material:

  1. Open the Material in the Inspector.
  2. In the Surface Options section, set the Materials Material Type to Subsurface Scattering or Translucent, depending on the effect you want.
  3. In the Surface Inputs section, select Diffusion Profile and assign a diffusion profile.
  4. If a warning box appears below the Diffusion Profile property, select Fix.

The following image displays grass in an environment scene. In the left image the grass renders correctly. The grass in the right image has the bright green tint that HDRP applies to a Material that doesn't have a valid diffusion profile:

The Material appears bright green in the following cases:

  • The Material doesn't have a diffusion profile assigned.

  • The Diffusion profile assigned in the Material is not included in a Diffusion Profile List

Customizing Subsurface Scattering

When you select Subsurface Scattering or Translucent from the Material Type drop-down, Unity exposes several new properties in the Material UI. For information on how to use these properties to customize the behavior of the subsurface scattering effect, see the Material Type documentation and the Diffusion Profile documentation.

Materials and Shader Graphs that use subsurface scattering do not use the Metallic property. This creates available space in the GBuffer to store all data related to subsurface scattering.

You can learn more about HDRPs subsurface scattering implementation in our Efficient Screen-Space Subsurface Scattering presentation.