Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed Probe volume debug exposure compensation to match the Lighting debug one.
- Fixed misleading text and improving the eye scene material samples. (case 1368665)
- MaterialReimporter.ReimportAllMaterials and MaterialReimporter.ReimportAllHDShaderGraphs now batch the asset database changes to improve performance.
- Fixed missing DisallowMultipleComponent annotations in HDAdditionalReflectionData and HDAdditionalLightData (case 1365879).
- Fixed support for light/shadow dimmers (volumetric or not) in path tracing.
- Fixed ambient occlusion strenght incorrectly using GTAOMultiBounce

## [12.0.0] - 2021-01-11

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ Single-sided or no Transmission

Double-sided + Transmission

### Hair

Path tracing can easily compute the complex multiple scattering events that occur within a head of hair, crucial for producing the volumetric look of lighter colored hair.

The [Hair Master Stack](master-stack-hair.md) allows the choice between an **Approximate** and **Physical** material mode and parameterization. Currently, it is required for a Hair Material to be configured with the **Physical** mode to participate in path tracing. The reason for this is due to the physically-based parameterization of the model (and the model itself) which produces far more accurate results in a path traced setting. Moreover, the **Approximate** material mode is a non energy-conserving model, better suited for performant rasterization after careful artist tuning.

Representing hair strand geometry is traditionally done via ray-aligned "ribbons", or tubes. Currently, the acceleration structure is not equipped to handle ray-aligned ribbons, so hair must be represented with tube geometry to achieve a good result.

The path traced **Physical** hair mode shares the exact same meaning for its parameters as its rasterized counterpart. However, the underlying model for path tracing differs: it performs a much more rigorous evaluation of the scattering within the fiber, while the rasterized version is only an approximated version of this result. Additionally, path tracing a volume of densely packed hair fibers allows you to compute the complex multiple scattering "for free", whereas in rasterizing we again must approximate this.

You can read more about the parameterization details of the **Physical** hair mode [here](master-stack-hair.md).

## Limitations

This section contains information on the limitations of HDRP's path tracing implementation. Mainly, this is a list of features that HDRP supports in its rasterized render pipeline, but not in its path-traced render pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ HDRP 2021.2 has various tessellation shader code to enable tessellation support
* HDRP has improved support of motion vectors for tessellation. Only `previousPositionRWS` is part of the varyings. HDRP also added the `MotionVectorTessellation()` function. For more information, see the `MotionVectorVertexShaderCommon.hlsl` file.
* HDRP now evaluates the `tessellationFactor` in the vertex shader and passes it to the hull shader as an interpolator. For more information, see the `VaryingMesh.hlsl` and `VertMesh.hlsl` files.

### Specular Occlusion
### Ambient Occlusion and Specular Occlusion

The algorithm for computing specular occlusion from bent normals and ambient occlusion has been changed to improve visual results.
To use the old algorithm, function calls to `GetSpecularOcclusionFromBentAO` should be replaced by calls to `GetSpecularOcclusionFromBentAO_ConeCone`

The algorithm to calculate the contribution of ambient occlusion and specular occlusion to direct lighting have been change from taking into account the multi-bounce contribution (GTAOMultiBounce) to not using the multi-bounce which is more correct.

### Light list

The previous `g_vLightListGlobal` uniform have been rename to explicit `g_vLightListTile` and `g_vLightListCluster` light list name. This work required to fix a wrong behavior on console.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,38 @@ To create a Hair material in Shader Graph, you can either:
* Create a new Shader Graph.
1. Go to **Assets > Create >Shader Graph > HDRP** and click **Hair Shader Graph**.

## Approximate and Physically Based Models

The Hair Master Stack offers two model sub-types: **Approximate** and **Physical**. By default, a newly created Hair Shader Graph is configured to use the **Approximate** mode. To change it, simply navigate to the Graph Inspector and change the Hair's **Material Type** from **Approximate** to **Physical**. It's important to note that the **Physical** model is currently recommended to only be used when representing hair with strand geometry.

![](Images/hair-kajiya.png)

The **Approximate** mode is a non energy-conserving model that was originally crafted against perceptual observations of human hair. Effective use of this model requires the artist to carefully balance the energy between the specular terms using multiple color parameters. Generally, the **Approximate** mode is accurate enough for darker hair, but falls short for lighter hair. Additionally, it is the faster of the two models to compute. The **Approximate** mode is based upon the Kajiya-Kay hair shading model.

![](Images/hair-marschner.png)

The **Physical** mode puts parameters in much simpler and meaningful terms. This model is considered to be physically-based due to its considerations for how incident light has been measured to scatter in a hair fiber. While the **Approximate** variant requires four color parameters to tune overall appearance, the **Physical** variant only requires one. The **Base Color** parameter defines the hair cortex absorption, the fibrous structure underlying the cuticle scale. Additionally, the model is energy conserving, so no careful balancing of inputs should be required for your hair to fit naturally into any lighting scenario. The **Physical** mode is based on the Marschner human hair fiber reflectance model.

A crucial component to the appearance of (especially light colored) hair is *multiple scattering*. Almost always, we never shade just a single hair fiber, but typically many thousands of fibers within close adjacency to one another. Because of this, coupled with the fact that light colored (lower absorbing) hair transmits large amount of light, the overall effect is a volumetric appearance to a head of light colored hair.

![](Images/hair-multiple-scattering.png)

When using the **Physical Material Type**, a **Scattering Mode** option will appear in the Graph Inspector. The **Scattering Mode** also comes with an **Approximate** and **Physical** option to choose from. By default, the **Physical Material Type** is configured to use the **Approximate Scattering Mode**.

The **Approximate Scattering Mode** is a diffuse approximation term that extremely coarsely estimates the multiple scattering phenomenon (seen left). The approximation is coarse because it does not take into account the propogation and attenuation of light through a hair volume due to transmittance, and ignores the effect that a hair's roughness has on the spread of light.

The **Physical Scattering Mode** performs a physically based simulation of light propogating through a volume of hair (seen right). This mode is only allowed for the **Physical Material Type** since the computation is dependant on the physically based nature of the model.

The computation of the **Physical Scattering Mode** is dependent on the use of a strand geometry representation. Additionally, this approach has a dependency on important precomputed information stored in a **Strand Count Probe**. The **Strand Count Probe** is an L1 Band Spherical Harmonic of the directional hair fiber densities at a point in a hair volume. While it can be computed manually, this data is not readily available at the moment. The accessibility of the **Physical Scattering Mode** will be improved in future releases.

## Geometry Type

Geometric representation of Hair and Fur in computer graphics is accomplished in one of three common ways: shells, cards, or strands. In the **Hair Master Stack**, the **Geometry Type** option allows you to specify which of these geometric representations you are using for your hair. Choosing the corresponding options to your geometry type allows appropriate assumptions to be made when compute the shading model. Currently, the **Geometry Type** allows you to specify between **Cards** and **Strands**.

The **Cards** representation is a common approach for games. The concept of hair cards is to project a high resolution hair groom down onto a simplified proxy mesh (composed of the "cards"). This is a favorable approach for games since it greatly simplifies the complexity of strands while still producing good and performant results.

The **Strands** representation is a growing trend in real-time graphics, as modern compute processing power continues to increase. The concept of hair strand geometry is to fully represent each individual hair fiber, either in the shape of "tube" geometry or a screen-aligned "ribbon".

## Contexts

[!include[](snippets/master-stacks-contexts-intro.md)]
Expand Down Expand Up @@ -110,6 +142,7 @@ Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add
[!include[](snippets/shader-graph-blocks/smoothness-radial.md)]
[!include[](snippets/shader-graph-blocks/cuticle-angle.md)]
[!include[](snippets/shader-graph-blocks/strand-count-probe.md)]
[!include[](snippets/shader-graph-blocks/strand-shadow-bias.md)]
</table>

## Graph Settings
Expand All @@ -120,6 +153,7 @@ Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add
<th>Property</th>
<th>Description</th>
</tr>
[!include[](snippets/shader-properties/surface-options/material-type-hair.md)]
[!include[](snippets/shader-properties/surface-options/surface-type.md)]
[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
Expand Down Expand Up @@ -160,5 +194,4 @@ Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add
[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
[!include[](snippets/shader-properties/advanced-options/geometry-type.md)]
[!include[](snippets/shader-properties/advanced-options/scattering-mode.md)]
[!include[](snippets/shader-properties/advanced-options/allow-radial-smoothness.md)]
</table>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<tr>
<td>**Cuticle Angle**</td>
<td>The angle (in degrees) that the scales on a hair fiber tilt from the strand direction. For human hair, this value is usually between 2 to 3 degrees. Use this property to “shift” the highlight.</td>
<td>None</td>
<td>&#8226; **Material Type** set to **Physical**</td>
<td>3</td>
</tr>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<tr>
<td>**Radial Smoothness**</td>
<td>Controls the internal scattering of light paths and the amount of light the hair fiber absorbs. To use this property, enable **Allow Radial Smoothness**.</td>
<td>None</td>
<td>0.5</td>
<td>Controls the internal scattering of light paths and the amount of light the hair fiber absorbs.</td>
<td>&#8226; **Material Type** set to **Physical**</td>
<td>0.7</td>
</tr>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<tr>
<td>**Strand Count Probe**</td>
<td>The four coefficients of an L0 and L1 spherical harmonic near the shading position. Encoded with the strand count on the sphere of directions.</td>
<td>None</td>
<td>&#8226; **Material Type** set to **Physical**&#8226; **Scattering Mode** set to **Advanced**</td>
<td>0.0</td>
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<tr>
<td>**Strand Shadow Bias**</td>
<td>The extent (in meters) at which the spline is biased toward the light to prevent scattering occlusion.</td>
<td>&#8226; **Material Type** set to **Physical**&#8226; **Scattering Mode** set to **Advanced**</td>
<td>0.0</td>
</tr>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<tr>
<td>**Scattering Mode**</td>
<td>Indicates the method by which the scattering of light is calculated in a volume of hair. Requires the "Marschner" Material Type and "Strands" Geometry Type to use:
<br/>&#8226; **Approximate**: Fall back to a simplified diffuse component to approximate hair color. This is generally acceptable for high-absorbent (dark) hair.
<br/>&#8226; **Advanced**: Simulate the scattering of light through a volume of hair strands. This is important for depicting low-absorbent (light) hair. Adds the Strand Probe Volume block parameter.</td>
<td>Indicates the light scattering method in a volume of hair. Requires the **Physical** Material Type and **Strands** Geometry Type to use:
<br/>&#8226; **Approximate**: Fall back to a simplified diffuse component to approximate hair color. This is generally acceptable for high-absorbent (dark) hair. This is the default for both Material types.
<br/>&#8226; **Advanced**: Simulate the scattering of light through a volume of hair strands. This is important for depicting low-absorbent (light) hair. Adds the **Strand Probe Volume** parameter.</td>
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<tr>
<td>**Material Type**</td>
<td>Specifies the type of Material the Hair Shader represents. The options are:<br/>&#8226; **Basic**: A lightweight, non energy-conserving variant based on the Kajiya-Kay model. Suitable for hair card geometry.<br/>&#8226; **Physical**: A more computationally intensive physically-based variant inspired by the Marschner model. Suitable for hair strand geometry.</td>
</tr>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ class HairData : HDTargetData
{
public enum MaterialType
{
KajiyaKay,
Marschner
Approximate,
Physical
}

public enum ScatteringMode
{
Approximate,
Physical
}

public enum ColorParameterization
Expand All @@ -25,12 +31,6 @@ public enum GeometryType
Strands
}

public enum ScatteringMode
{
Approximate,
Advanced
}

[SerializeField]
MaterialType m_MaterialType;
public MaterialType materialType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class HairSurfaceOptionPropertyBlock : SurfaceOptionPropertyBlock
{
class Styles
{
public static GUIContent materialType = new GUIContent("Material Type", "TODO");
public static GUIContent materialType = new GUIContent("Material Type", "Indicates the type of Shading Model used to evaluate lighting.");
}

HairData hairData;
Expand All @@ -39,7 +39,7 @@ class Styles
{
public static GUIContent colorParameterization = new GUIContent("Color Mode", "Indicates the way the hair fiber cortex color is parameterized.");
public static GUIContent geometryType = new GUIContent("Geometry Type", "Indicates the type of geometry being used to represent the hair, allowing the shading model to make informed approximations.");
public static GUIContent scatteringMode = new GUIContent("Scattering Mode", "TODO");
public static GUIContent scatteringMode = new GUIContent("Scattering Mode", "Indicates the light scattering method in a volume of hair.");
}

HairData hairData;
Expand All @@ -56,7 +56,7 @@ protected override void CreatePropertyGUI()
// Hair specific properties GUI
AddProperty(Styles.geometryType, () => hairData.geometryType, (newValue) => hairData.geometryType = newValue);

if (hairData.materialType == HairData.MaterialType.Marschner)
if (hairData.materialType == HairData.MaterialType.Physical)
{
// For now only allow scattering mode for strands, as the multiple scattering was developed against this for 21.2.
if (hairData.geometryType == HairData.GeometryType.Strands)
Expand Down
Loading