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
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The version number for this package has increased due to a version update of a r
- Added quality preset of the new volumetric fog parameters.
- Added missing documentation for unsupported SG RT nodes and light's include for raytracing attrbute.
- Added documentation for LODs not being supported by ray tracing.
- Added more options to control how the component of motion vectors coming from the camera transform will affect the motion blur with new clamping modes.

### Fixed
- Fixed an issue where the Exposure Shader Graph node had clipped text. (case 1265057)
Expand Down
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 @@ -17,20 +17,25 @@ Motion Blur includes [more options](More-Options.md) that you must manually expo

![](Images/Post-processingMotionBlur1.png)

| **Property** | **Description** |
| ---------------------------------- | ------------------------------------------------------------ |
| **Intensity** | Set the strength of the Motion Blur effect. This scales the magnitude of the velocities present in the velocity buffer. Set this value to 0 to disable Motion Blur. |
| **Quality** | Specifies the quality level to use for this effect. Each quality level applies different preset values. Unity also stops you from editing the properties that the preset overrides. If you want to set your own values for every property, select **Custom**. |
| **Sample Count** | Set the maximum number of sample points HDRP uses to compute the Motion Blur effect. Higher values increase the quality and produce a smoother blur. Higher values also increase the resource intensity of the effect. |
| **Maximum Velocity** | Use the slider to set the maximum velocity, in pixels, that HDRP allows for all sources of motion blur except Camera rotation. This clamps any value above this threshold to the threshold value. Higher values result in a more intense blur, and an increase in resource intensity. |
| **Minimum Velocity** | Use the slider to set the minimum velocity, in pixels, that triggers motion blur. Higher values mean that HDRP does not calculate Motion Blur for slow-moving GameObjects. This decreases the resource intensity. |
| **Camera Rotation Velocity Clamp** | Use the slider to set the maximum velocity that HDRP allows Camera rotation to contribute to the velocities of GameObjects. This value is expressed in terms of screen fraction. Higher values result in Camera rotation giving wider blurs. |
| **Camera Motion Blur** | Indicates whether camera movement contributes to motion blur. Disable this property to stop camera movement from contributing to motion blur. |
| **Property** | **Description** |
| ------------------------- | ------------------------------------------------------------ |
| **Intensity** | Set the strength of the Motion Blur effect. This scales the magnitude of the velocities present in the velocity buffer. Set this value to 0 to disable Motion Blur. |
| **Quality** | Specifies the quality level to use for this effect. Each quality level applies different preset values. Unity also stops you from editing the properties that the preset overrides. If you want to set your own values for every property, select **Custom**. |
| **Sample Count** | Set the maximum number of sample points HDRP uses to compute the Motion Blur effect. Higher values increase the quality and produce a smoother blur. Higher values also increase the resource intensity of the effect. |
| **Maximum Velocity** | Use the slider to set the maximum velocity, in pixels, that HDRP allows for all sources of motion blur except Camera rotation. This clamps any value above this threshold to the threshold value. Higher values result in a more intense blur, and an increase in resource intensity. |
| **Minimum Velocity** | Use the slider to set the minimum velocity, in pixels, that triggers motion blur. Higher values mean that HDRP does not calculate Motion Blur for slow-moving GameObjects. This decreases the resource intensity. |
| **Camera Motion Blur** | Indicates whether camera movement contributes to motion blur. Disable this property to stop camera movement from contributing to motion blur. |
| **Camera Clamp Mode** | Specifies the method HDRP uses to clamp the motion vectors that derive from camera movement/rotation. Note that although this specifically clamps the motion vectors that come from the camera, this may change motion vector velocities relative to the camera too. For example, a GameObject that has the camera as a parent (and thus moves and rotates with the camera) might not have a zero motion vector when the camera moves. The options are:<br />&#8226; **None**: The motion vector component derived from the Camera is not treated differently.<br />&#8226;**Rotation: **The motion vector component derived from the Camera rotation is clamped separately.<br />&#8226;**Translation**: The motion vector component derived from the Camera translation is clamped separately.<br />&#8226;**Separate Translation And Rotation**: The motion vector components derived from the Camera rotation and translation are clamped separately with separate clamp options.<br />&#8226;**Full Camera Motion Vector**: The full motion vector component derived from the Camera full movement (rotation and translation) is clamped separate from the Object motion, but with a single threshold. |
| **- Rotation Clamp** | Use the slider to set the maximum velocity that HDRP allows Camera rotation to contribute to the velocities of GameObjects. This value is expressed in terms of screen fraction. Higher values result in Camera rotation giving wider blurs. <br/>This property is only relevant if you set **Camera Clamp Mode** to **Rotation** or **Separate Translation And Rotation**. |
| **- Translation Clamp** | Use the slider to set the maximum velocity that HDRP allows Camera translation to contribute to the velocities of GameObjects. This value is expressed in terms of screen fraction. Higher values result in Camera rotation giving wider blurs. <br/>This property is only relevant if you set **Camera Clamp Mode** to **Translation** or **Separate Translation And Rotation**. |
| **- Motion Vector Clamp** | Use the slider to set the maximum velocity that HDRP allows Camera transform changes to contribute to the velocities of GameObjects. This value is expressed in terms of screen fraction. Higher values result in Camera rotation giving wider blurs. <br/>This property is only relevant if you set **Camera Clamp Mode** to **Full Camera Motion Vector**. |

## Details

There are multiple options available to decrease the performance impact of Motion Blur. Listed in order of effectiveness, you can:

1. Reduce the **Sample Count**. A lower sample count directly translates to higher performance. However, it is important to keep in mind that the algorithm clamps the maximum amount of samples so that no two samples are less than a pixel apart, so a high sample count does not affect slowly moving GameObjects very much.
2. Increase the **Minimum Velocity**. Increase this threshold to make HDRP blur less of the screen. If many GameObjects are at a velocity below this threshold, HDRP does not calculate Motion Blur for them, and the resource intensity of the effect decreases.
3. Decrease the **Maximum Velocity** and the **Camera Rotation Velocity Clamp**. This gives a less intense blur, which leads to an access pattern that is more friendly to the GPU.
3. Decrease the **Maximum Velocity** and the **Camera Clamp** parameters. This gives a less intense blur, which leads to an access pattern that is more friendly to the GPU.

If you select a **Camera Clamp Mode** other than **None**, motion vectors that are usually relative to camera motion no longer are. For example, if an object has the camera as a parent and thus perfectly follows the camera, normally that object has a motion vector with a length close to zero. However, if the camera uses a different clamping method to object, the final velocity length is likely not zero if the clamping point is reached.
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,8 @@ This change can affect you if you had multiple HDRP asset setup as **Quality Set

We recommend to put all the diffusion profiles used in your project in the HDRP Asset assigned in the **Graphics Settings** before upgrading. This operation will prevent any issue after the upgrade regarding lost diffusion profile in the project.

## Post Processing

Previously, in the Motion Blur volume component the camera rotation clamp was always active such that by default the part of the motion vector derived from camera rotation was clamped differently. This can create confusion due to changes in motion vectors that are relative to camera.

From 2020.2, the camera rotation clamp option is not the default, but needs to be selected as an option under the **Camera Clamp Mode** setting. Moreover, additional clamping controls on camera influence on motion blur are available under the same setting.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ sealed class MotionBlurEditor : VolumeComponentWithQualityEditor
SerializedDataParameter m_MinVelInPixels;

// Advanced properties
SerializedDataParameter m_CameraMVClampMode;
SerializedDataParameter m_CameraTransClamp;
SerializedDataParameter m_CameraRotClamp;
SerializedDataParameter m_CameraFullClamp;

SerializedDataParameter m_DepthCmpScale;
SerializedDataParameter m_CameraMotionBlur;

Expand All @@ -29,6 +33,9 @@ public override void OnEnable()
m_SampleCount = Unpack(o.Find("m_SampleCount"));
m_MinVelInPixels = Unpack(o.Find(x => x.minimumVelocity));
m_MaxVelocityInPixels = Unpack(o.Find(x => x.maximumVelocity));
m_CameraMVClampMode = Unpack(o.Find(x => x.specialCameraClampMode));
m_CameraFullClamp = Unpack(o.Find(x => x.cameraVelocityClamp));
m_CameraTransClamp = Unpack(o.Find(x => x.cameraTranslationVelocityClamp));
m_CameraRotClamp = Unpack(o.Find(x => x.cameraRotationVelocityClamp));
m_DepthCmpScale = Unpack(o.Find(x => x.depthComparisonExtent));
m_CameraMotionBlur = Unpack(o.Find(x => x.cameraMotionBlur));
Expand All @@ -53,11 +60,45 @@ public override void OnInspectorGUI()
PropertyField(m_MaxVelocityInPixels);
PropertyField(m_MinVelInPixels);

if(advanced)
if (advanced)
{
PropertyField(m_DepthCmpScale);
PropertyField(m_CameraRotClamp);

EditorGUILayout.Space();
EditorGUILayout.LabelField("Camera Velocity", EditorStyles.miniLabel);

PropertyField(m_CameraMotionBlur);


using (new EditorGUI.DisabledScope(!m_CameraMotionBlur.value.boolValue))
{
PropertyField(m_CameraMVClampMode, EditorGUIUtility.TrTextContent("Camera Clamp Mode", "Determine if and how the component of the motion vectors coming from the camera is clamped in a special fashion."));

using (new HDEditorUtils.IndentScope())
{
var mode = m_CameraMVClampMode.value.intValue;
using (new EditorGUI.DisabledScope(!(mode == (int)CameraClampMode.Rotation || mode == (int)CameraClampMode.SeparateTranslationAndRotation)))
{
PropertyField(m_CameraRotClamp, EditorGUIUtility.TrTextContent("Rotation Clamp", "Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera rotation can have." +
" Only valid if Camera clamp mode is set to Rotation or Separate Translation And Rotation."));
}
using (new EditorGUI.DisabledScope(!(mode == (int)CameraClampMode.Translation || mode == (int)CameraClampMode.SeparateTranslationAndRotation)))
{
PropertyField(m_CameraTransClamp, EditorGUIUtility.TrTextContent("Translation Clamp", "Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera translation can have." +
" Only valid if Camera clamp mode is set to Translation or Separate Translation And Rotation."));

}
using (new EditorGUI.DisabledScope(mode != (int)CameraClampMode.FullCameraMotionVector))
{
PropertyField(m_CameraFullClamp, EditorGUIUtility.TrTextContent("Motion Vector Clamp", "Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera movement can have." +
" Only valid if Camera clamp mode is set to Full Camera Motion Vector."));

}
}
}



}
}
public override QualitySettingsBlob SaveCustomQualitySettingsAsObject(QualitySettingsBlob settings = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,52 @@

namespace UnityEngine.Rendering.HighDefinition
{

/// <summary>
/// Determine how the component of the motion vectors coming from the camera are clamped.
/// </summary>
public enum CameraClampMode
{
/// <summary>
/// Camera derived motion vectors are not treated differently.
/// </summary>
None = 0,

/// <summary>
/// Clamp camera rotation separately.
/// </summary>
Rotation = 1,

/// <summary>
/// Clamp camera rotation separately.
/// </summary>
Translation = 2,

/// <summary>
/// Clamp camera rotation and translation separately.
/// </summary>
SeparateTranslationAndRotation = 3,

/// <summary>
/// Clamp the motion vectors coming from the camera entirely (translation and rotation included).
/// </summary>
FullCameraMotionVector = 4,
}

/// <summary>
/// A <see cref="VolumeParameter"/> that holds a <see cref="CameraClampMode"/> value.
/// </summary>
[Serializable]
public sealed class CameraClampModeParameter : VolumeParameter<CameraClampMode>
{
/// <summary>
/// Creates a new <see cref="CameraClampModeParameter"/> instance.
/// </summary>
/// <param name="value">The initial value to store in the parameter.</param>
/// <param name="overrideState">The initial override state for the parameter.</param>
public CameraClampModeParameter(CameraClampMode value, bool overrideState = false) : base(value, overrideState) { }
}

/// <summary>
/// A volume component that holds settings for the Motion Blur effect.
/// </summary>
Expand All @@ -29,22 +75,42 @@ public sealed class MotionBlur : VolumeComponentWithQuality, IPostProcessCompone
public ClampedFloatParameter minimumVelocity = new ClampedFloatParameter(2.0f, 0.0f, 64.0f);

/// <summary>
/// Sets the maximum length, as a fraction of the screen's full resolution, that the velocity resulting from Camera rotation can have.
/// If toggled on camera rotation can be clamped differently.
/// </summary>
[Tooltip("Sets the maximum length, as a fraction of the screen's full resolution, that the velocity resulting from Camera rotation can have.")]
public ClampedFloatParameter cameraRotationVelocityClamp = new ClampedFloatParameter(0.03f, 0.0f, 0.2f);
[Tooltip("If toggled off, the motion caused by the camera is not considered when doing motion blur.")]
public BoolParameter cameraMotionBlur = new BoolParameter(true);


/// <summary>
/// Value used for the depth based weighting of samples. Tweak if unwanted leak of background onto foreground or viceversa is detected.
/// Determine how the component of the motion vectors coming from the camera is clamped. It is important to remember that clamping the camera component separately, velocities relative to camera might change too (e.g. an object parented to a camera
/// when the camera moves might not have a 0 motion vector anymore).
/// </summary>
[Tooltip("Value used for the depth based weighting of samples. Tweak if unwanted leak of background onto foreground or viceversa is detected.")]
public ClampedFloatParameter depthComparisonExtent = new ClampedFloatParameter(1.0f, 0.0f, 20.0f);
[Tooltip("Determine if and how the component of the motion vectors coming from the camera is clamped in a special fashion.")]
public CameraClampModeParameter specialCameraClampMode = new CameraClampModeParameter(CameraClampMode.None);

/// <summary>
/// If toggled off, the motion caused by the camera is not considered when doing motion blur.
/// Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera movement can have. Only valid if specialCameraClampMode is set to CameraClampMode.FullCameraMotionVector.
/// </summary>
[Tooltip("If toggled off, the motion caused by the camera is not considered when doing motion blur.")]
public BoolParameter cameraMotionBlur = new BoolParameter(true);
[Tooltip("Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera can have.")]
public ClampedFloatParameter cameraVelocityClamp = new ClampedFloatParameter(0.05f, 0.0f, 0.3f);

/// <summary>
/// Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera can have. Only valid if specialCameraClampMode is set to CameraClampMode.Translation or CameraClampMode.SeparateTranslationAndRotation.
/// </summary>
[Tooltip("Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera can have.")]
public ClampedFloatParameter cameraTranslationVelocityClamp = new ClampedFloatParameter(0.05f, 0.0f, 0.3f);

/// <summary>
/// Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera rotation can have. Only valid if specialCameraClampMode is set to CameraClampMode.Rotation or CameraClampMode.SeparateTranslationAndRotation.
/// </summary>
[Tooltip("Sets the maximum length, as a fraction of the screen's full resolution, that the motion vectors resulting from Camera rotation can have.")]
public ClampedFloatParameter cameraRotationVelocityClamp = new ClampedFloatParameter(0.03f, 0.0f, 0.3f);

/// <summary>
/// Value used for the depth based weighting of samples. Tweak if unwanted leak of background onto foreground or viceversa is detected.
/// </summary>
[Tooltip("Value used for the depth based weighting of samples. Tweak if unwanted leak of background onto foreground or viceversa is detected.")]
public ClampedFloatParameter depthComparisonExtent = new ClampedFloatParameter(1.0f, 0.0f, 20.0f);

/// <summary>
/// Sets the maximum number of sample points that HDRP uses to compute motion blur.
Expand Down
Loading