Skip to content

Merge 7.x.x/hd/staging [Skip CI] #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ac93e17
[7.x.x Backport] Fixed a weird behavior in the scalable settings draw…
anisunity Apr 3, 2020
f4f74f1
Fixed an usage of a a compute buffer not bound (1229964) (#28)
sebastienlagarde Apr 7, 2020
5ddc5f7
Removed wrongly serialized fields in StaticLightingSky (#6441)
JulienIgnace-Unity Apr 3, 2020
5faae4d
Fix issues in the post process system with RenderTexture being invali…
sebastienlagarde Apr 7, 2020
3531a57
Update PostProcessSystem.cs
sebastienlagarde Apr 7, 2020
84b722d
Fixed an issue where changing the default volume profile from anothe…
JulienIgnace-Unity Apr 3, 2020
0cd0299
Hdrp/docs/glossary f number (#6523)
JordanL8 Apr 2, 2020
accff86
Clamp probes compression factor to 0 (#19)
FrancescoC-unity Apr 7, 2020
b754f52
path validation when creating new volume profile (#36)
sebastienlagarde Apr 7, 2020
aaf7bf5
Merge branch '7.x.x/release' into 7.x.x/hd/staging
sebastienlagarde Apr 8, 2020
bc7cc75
[Backport 7.x.x] Fix various leaks in HDRP (#120)
JulienIgnace-Unity Apr 15, 2020
359afb4
[7.x.x backport] Follow references when deleting unloading unused ass…
FrancescoC-unity Apr 15, 2020
9993a1c
[7.x.x Backport] Fixed an issue with the specularFGD term being used …
anisunity Apr 16, 2020
4f857b0
Merge branch '7.x.x/release' into 7.x.x/hd/staging
sebastienlagarde Apr 16, 2020
f4c7b7f
d Fix MSAA resolve when there is no motion vectors #1
adrien-de-tocqueville Apr 14, 2020
8cb689f
Fix issues causing planar probes to be broken with multiple cameras i…
FrancescoC-unity Apr 15, 2020
7d010f4
Pospow and SG triplanar fix #40
slunity Apr 8, 2020
4410bd1
Hdrp/fix/custom pass msaa rendering info #42
alelievr Apr 9, 2020
67e7c73
Added disocclusion and ghosting to the glossary (#75)
JordanL8 Apr 9, 2020
6e624d2
Update the scripting API for FrameSettings, FrameSettingsOverrideMask…
RSlysz Apr 16, 2020
bf34a59
fix switch shader compilation (#111)
sebastienlagarde Apr 14, 2020
417b5d1
Update SceneViewDrawMode.cs (#118)
sebastienlagarde Apr 14, 2020
dd03aa3
Fix culling of reflection probes that change position #121
pmavridis Apr 15, 2020
5111f69
Fix null reference when processing light probe #131
pmavridis Apr 15, 2020
61886f3
Fix black screen in XR when HDRP package is present but not used #137
fabien-unity Apr 15, 2020
9d9eb87
Fix default volume profile collapse #138
alelievr Apr 16, 2020
8c0e270
Fix for white flash happening when changing lighting condition (like …
sebastienlagarde Apr 16, 2020
5b4fce1
Added baked GI rp support caveat and made setting shadow filter quali…
JordanL8 Apr 16, 2020
ffc58cd
Update AxF-Shader.md (#152)
JordanL8 Apr 16, 2020
4f787c2
Bind missing buffer #159
victor-unity Apr 16, 2020
2b1b282
Merge branch '7.x.x/release' into 7.x.x/hd/staging
sebastienlagarde Apr 16, 2020
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.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,26 @@ public static TType instance
{
if (s_Instance == null)
{
GameObject go = new GameObject("Default " + typeof(TType)) { hideFlags = HideFlags.HideAndDontSave };
GameObject go = new GameObject("Default " + typeof(TType).Name) { hideFlags = HideFlags.HideAndDontSave };
go.SetActive(false);
s_Instance = go.AddComponent<TType>();
}

return s_Instance;
}
}

/// <summary>
/// Release the component singleton.
/// </summary>
public static void Release()
{
if (s_Instance != null)
{
var go = s_Instance.gameObject;
CoreUtils.Destroy(go);
s_Instance = null;
}
}
}
}
20 changes: 10 additions & 10 deletions com.unity.render-pipelines.core/Runtime/Utilities/BitArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ namespace UnityEngine.Rendering
/// </summary>
public interface IBitArray
{
/// <summary>Number of elements in the bit array.</summary>
/// <summary>Gets the capacity of this BitArray. This is the number of bits that are usable.</summary>
uint capacity { get; }
/// <summary>True if all bits are 0.</summary>
/// <summary>Return `true` if all the bits of this BitArray are set to 0. Returns `false` otherwise.</summary>
bool allFalse { get; }
/// <summary>True if all bits are 1.</summary>
/// <summary>Return `true` if all the bits of this BitArray are set to 1. Returns `false` otherwise.</summary>
bool allTrue { get; }
/// <summary>
/// Returns the state of the bit at a specific index.
/// An indexer that allows access to the bit at a given index. This provides both read and write access.
/// </summary>
/// <param name="index">Index of the bit.</param>
/// <returns>State of the bit at the provided index.</returns>
bool this[uint index] { get; set; }
/// <summary>Returns the bit array in a human readable form.</summary>
/// <summary>Writes the bits in the array in a human-readable form. This is as a string of 0s and 1s packed by 8 bits. This is useful for debugging.</summary>
string humanizedData { get; }

/// <summary>
/// Bit-wise And operation.
/// Perform an AND bitwise operation between this BitArray and the one you pass into the function and return the result. Both BitArrays must have the same capacity. This will not change current BitArray values.
/// </summary>
/// <param name="other">Bit array with which to the And operation.</param>
/// <param name="other">BitArray with which to the And operation.</param>
/// <returns>The resulting bit array.</returns>
IBitArray BitAnd(IBitArray other);
/// <summary>
/// Bit-wise Or operation.
/// Perform an OR bitwise operation between this BitArray and the one you pass into the function and return the result. Both BitArrays must have the same capacity. This will not change current BitArray values.
/// </summary>
/// <param name="other">Bit array with which to the Or operation.</param>
/// <param name="other">BitArray with which to the Or operation.</param>
/// <returns>The resulting bit array.</returns>
IBitArray BitOr(IBitArray other);
/// <summary>
/// Invert the bit array.
/// Return the BitArray with every bit inverted.
/// </summary>
/// <returns></returns>
IBitArray BitNot();
Expand Down
45 changes: 45 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,51 @@ uint FastLog2(uint x)
// Note: https://msdn.microsoft.com/en-us/library/windows/desktop/bb509636(v=vs.85).aspx pow(0, >0) == 0
TEMPLATE_2_REAL(PositivePow, base, power, return pow(abs(base), power))

// SafePositivePow: Same as pow(x,y) but considers x always positive and never exactly 0 such that
// SafePositivePow(0,y) will numerically converge to 1 as y -> 0, including SafePositivePow(0,0) returning 1.
//
// First, like PositivePow, SafePositivePow removes this warning for when you know the x value is positive or 0 and you know
// you avoid a NaN:
// ie you know that x == 0 and y > 0, such that pow(x,y) == pow(0, >0) == 0
// SafePositivePow(0, y) will however return close to 1 as y -> 0, see below.
//
// Also, pow(x,y) is most probably approximated as exp2(log2(x) * y), so pow(0,0) will give exp2(-inf * 0) == exp2(NaN) == NaN.
//
// SafePositivePow avoids NaN in allowing SafePositivePow(x,y) where (x,y) == (0,y) for any y including 0 by clamping x to a
// minimum of FLT_EPS. The consequences are:
//
// -As a replacement for pow(0,y) where y >= 1, the result of SafePositivePow(x,y) should be close enough to 0.
// -For cases where we substitute for pow(0,y) where 0 < y < 1, SafePositivePow(x,y) will quickly reach 1 as y -> 0, while
// normally pow(0,y) would give 0 instead of 1 for all 0 < y.
// eg: if we #define FLT_EPS 5.960464478e-8 (for fp32),
// SafePositivePow(0, 0.1) = 0.1894646
// SafePositivePow(0, 0.01) = 0.8467453
// SafePositivePow(0, 0.001) = 0.9835021
//
// Depending on the intended usage of pow(), this difference in behavior might be a moot point since:
// 1) by leaving "y" free to get to 0, we get a NaNs
// 2) the behavior of SafePositivePow() has more continuity when both x and y get closer together to 0, since
// when x is assured to be positive non-zero, pow(x,x) -> 1 as x -> 0.
//
// TL;DR: SafePositivePow(x,y) avoids NaN and is safe for positive (x,y) including (x,y) == (0,0),
// but SafePositivePow(0, y) will return close to 1 as y -> 0, instead of 0, so watch out
// for behavior depending on pow(0, y) giving always 0, especially for 0 < y < 1.
//
// Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/bb509636(v=vs.85).aspx
TEMPLATE_2_REAL(SafePositivePow, base, power, return pow(max(abs(base), real(REAL_EPS)), power))

// Helpers for making shadergraph functions consider precision spec through the same $precision token used for variable types
TEMPLATE_2_FLT(SafePositivePow_float, base, power, return pow(max(abs(base), float(FLT_EPS)), power))
TEMPLATE_2_HALF(SafePositivePow_half, base, power, return pow(max(abs(base), half(HALF_EPS)), power))

float Eps_float() { return FLT_EPS; }
float Min_float() { return FLT_MIN; }
float Max_float() { return FLT_MAX; }
half Eps_half() { return HALF_EPS; }
half Min_half() { return HALF_MIN; }
half Max_half() { return HALF_MAX; }


// Composes a floating point value with the magnitude of 'x' and the sign of 's'.
// See the comment about FastSign() below.
float CopySign(float x, float s, bool ignoreNegZero = true)
Expand Down
13 changes: 13 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added an error message in the DrawRenderers custom pass when rendering opaque objects with an HDRP asset in DeferredOnly mode.
- Added Light decomposition lighting debugging modes and support in AOV
- Added exposure compensation to Fixed exposure mode
- Added an info box to warn about depth test artifacts when rendering object twice in custom passes with MSAA.

### Fixed
- Fixed an issue where a dynamic sky changing any frame may not update the ambient probe.
Expand Down Expand Up @@ -42,6 +43,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix for range compression factor for probes going negative (now clamped to positive values).
- Fixed path validation when creating new volume profile (case 1229933)
- Fixed the debug exposure mode for display sky reflection and debug view baked lighting
- Fixed various object leaks in HDRP.
- Fix for assertion triggering sometimes when saving a newly created lit shader graph (case 1230996)
- Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader).
- Fixed MSAA depth resolve when there is no motion vectors
- Fix issue causing wrong planar reflection rendering when more than one camera is present.
- Fixed culling of planar reflection probes that change position (case 1218651)
- Fixed null reference when processing lightprobe (case 1235285)
- Fix black screen in XR when HDRP package is present but not used.
- Fixed an issue that was collapsing the volume components in the HDRP default settings
- Fixed NaN which can appear with real time reflection and inf value
- Fixed warning about missing bound decal buffer
- Fix black screen in XR when HDRP package is present but not used.

### Changed
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This process does not duplicate the Textures and other resources that the origin

### Creating AxF Materials from scratch

New Materials in HDRP use the [Lit Shader](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@7.1/manual/Lit-Shader.html) by default. To create an AxF Material from scratch, create a Material and then make it use the AxF Shader. To do this:
New Materials in HDRP use the [Lit Shader](Lit-Shader.md) by default. To create an AxF Material from scratch, create a Material and then make it use the AxF Shader. To do this:

1. In the Unity Editor, navigate to your Project's Asset window.
2. Right-click the Asset Window and select **Create > Material**. This adds a new Material to your Unity Project’s Asset folder.
Expand Down Expand Up @@ -60,8 +60,9 @@ Note: The AxF Importer imports every Texture as half float, linear, sRGB gamut (
| --------------------- | ------------------------------------------------------------ |
| **Material Tiling U** | Sets the tile rate along the x-axis for every Texture in the **Surface Inputs** section. HDRP uses this value to tile the Textures along the x-axis of the Material’s surface, in object space. |
| **Material Tiling V** | Sets the tile rate along the y-axis for every Texture in the **Surface Inputs** section. HDRP uses this value to tile the Textures along the y-axis of the Material’s surface, in object space. |
| **BRDF Type** | Controls the main AxF Material representation.<br/>&#8226; **SVBRDF**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - SVBRDF](https://docs.google.com/document/d/1_Oq2hsx3J7h8GHKoQM_8qf6Ip5VlHv_31K7dYYVOEmU/edit#heading=h.f1msh9g44mev).<br/>&#8226;**CAR_PAINT**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - CAR_PAINT](https://docs.google.com/document/d/1_Oq2hsx3J7h8GHKoQM_8qf6Ip5VlHv_31K7dYYVOEmU/edit#heading=h.eorkre6buegg). |
| **BRDF Type** | Controls the main AxF Material representation.<br/>&#8226; **SVBRDF**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - SVBRDF](#SVBRDF).<br/>&#8226;**CAR_PAINT**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - CAR_PAINT](#CAR_PAINT). |

<a name="SVBRDF"></a>
#### BRDF Type - SVBRDF

| **Property** | **Description** |
Expand All @@ -86,6 +87,7 @@ Note: The AxF Importer imports every Texture as half float, linear, sRGB gamut (
| **- Enable Refraction** | Indicates whether the clear coat is refractive. If you enable this checkbox, HDRP uses angles refracted by the clear coat to evaluate the undercoat of the Material surface. |
| **- - Clearcoat IOR** | Specifies a Texture (red channel only) that implicitly defines the index of refraction (IOR) for the clear coat by encoding it to a monochromatic (single value) F0 (aka as specular color or Fresnel reflectance at 0 degree incidence. This also assumes the coat interfaces with air). As such, the value is in the range of **0** to **1** and HDRP calculates the final IOR as:<br/>`IOR = (1.0 + squareRoot(R) ) / (1.0 - squareRoot(R))`<br/>Where **R** is the normalized value in the red color channel of this Texture. Note: HDRP uses this IOR for both coat refraction and, if enabled, transmission and reflectance calculations through and on the coat. Therefore, you must always assign a Texture to this property when you enable clear coat. |

<a name="CAR_PAINT"></a>
#### BRDF Type - CAR_PAINT

| **Property** | **Description** |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,12 @@ A function that describes a wave that represents the human eye’s relative sens
#### punctual lights:
A light is considered to be punctual if it emits light from a single point. HDRPs Spot and Point Lights are punctual.

## Rendering Artifacts

<a name="Disocclusion"></a>
#### disocclusion
A rendering artifact that describes the situation where a GameObject that was previously occluded becomes visible.

<a name="Ghosting"></a>
#### ghosting
A rendering artifact that describes the situation where a moving GameObject leaves a trail of pixels behind it.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ Using high shadow bias values may result in light "leaking" through Meshes. This

After HDRP captures a shadow map, it processes filtering on the map in order to decrease the aliasing effect that occurs on low resolution shadow maps. Different filters affect the perceived sharpness of shadows.

To change which filter HDRP uses, change the **Filtering Quality** property in your Unity Project’s [HDRP Asset](HDRP-Asset.html). There are currently four filter quality presets for directional and punctual lights. For information on the available filter qualities, see the [Filtering Qualities table](HDRP-Asset.html#FilteringQualities).
To change which filter HDRP uses, the method depends on which filter quality you want to use and whether your HDRP Project uses [forward or deferred rendering](Forward-And-Deferred-Rendering.md).

Currently, if you want to use **High** quality (PCSS) filtering in [deferred](Forward-And-Deferred-Rendering.html) mode, you need to enable it in the [HDRP Config package](HDRP-Config-Package.html). For information on how to do this, see the [Example section](HDRP-Config-Package.html#Example) of the Config package documentation.
* **Forward rendering**: Change the **Filtering Quality** property in your Unity Project’s [HDRP Asset](HDRP-Asset.html). This method works for every filter quality. There are currently three filter quality presets for directional and punctual lights. For information on the available filter qualities, see the [Filtering Qualities table](HDRP-Asset.html#FilteringQualities).
* **Deferred rendering**: For **Low** and **Medium** filter qualities, use the same method as forward rendering. If you want to use **High** quality (PCSS) filtering, you need to enable it in the [HDRP Config package](HDRP-Config-Package.html). For information on how to do this, see the [Example section](HDRP-Config-Package.html#Example) of the Config package documentation.

## Shadowmasks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ static void OnShaderGraphSaved(Shader shader, object saveContext)

// Free the materials every 200 iterations, on big project loading all materials in memory can lead to a crash
if ((i % 200 == 0) && i != 0)
EditorUtility.UnloadUnusedAssetsImmediate(false);
EditorUtility.UnloadUnusedAssetsImmediate(true);
}
}
finally
{
EditorUtility.ClearProgressBar();
EditorUtility.UnloadUnusedAssetsImmediate(false);
EditorUtility.UnloadUnusedAssetsImmediate(true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ private class Styles
public static string unlitShaderMessage = "HDRP Unlit shaders will force the shader passes to \"ForwardOnly\"";
public static string hdrpLitShaderMessage = "HDRP Lit shaders are not supported in a custom pass";
public static string opaqueObjectWithDeferred = "Your HDRP settings does not support ForwardOnly, some object might not render.";
public static string objectRendererTwiceWithMSAA = "MSAA is enabled, re-rendering same object twice will cause depth test artifacts in Before/After Post Process injection points";
}

//Headers and layout
private int m_FilterLines = 3;
private int m_FilterLines = 2;
private int m_MaterialLines = 2;

// Foldouts
Expand All @@ -86,6 +87,8 @@ private class Styles

ReorderableList m_ShaderPassesList;

CustomPassVolume m_Volume;

bool customDepthIsNone => (CustomPass.TargetBuffer)m_TargetDepthBuffer.intValue == CustomPass.TargetBuffer.None;

protected override void Initialize(SerializedProperty customPass)
Expand All @@ -112,6 +115,8 @@ protected override void Initialize(SerializedProperty customPass)
m_DepthCompareFunction = customPass.FindPropertyRelative("depthCompareFunction");
m_DepthWrite = customPass.FindPropertyRelative("depthWrite");

m_Volume = customPass.serializedObject.targetObject as CustomPassVolume;

m_ShaderPassesList = new ReorderableList(null, m_ShaderPasses, true, true, true, true);

m_ShaderPassesList.drawElementCallback =
Expand All @@ -132,6 +137,14 @@ protected override void Initialize(SerializedProperty customPass)

protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
{
if (ShowMsaaObjectInfo())
{
Rect helpBoxRect = rect;
helpBoxRect.height = Styles.helpBoxHeight;
EditorGUI.HelpBox(helpBoxRect, Styles.objectRendererTwiceWithMSAA, MessageType.Info);
rect.y += Styles.helpBoxHeight;
}

DoFilters(ref rect);

m_RendererFoldout.boolValue = EditorGUI.Foldout(rect, m_RendererFoldout.boolValue, Styles.renderHeader, true);
Expand All @@ -156,7 +169,7 @@ protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
}
}

// Tel if we need to show a warning for rendering opaque object and we're in deferred.
// Tell if we need to show a warning for rendering opaque object and we're in deferred.
bool ShowOpaqueObjectWarning()
{
// Only opaque objects are concerned
Expand All @@ -173,6 +186,18 @@ bool ShowOpaqueObjectWarning()
return true;
}

// Tell if we need to show the MSAA message info
bool ShowMsaaObjectInfo()
{
if (!HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.supportMSAA)
return false;

if (m_Volume.injectionPoint != CustomPassInjectionPoint.AfterPostProcess && m_Volume.injectionPoint != CustomPassInjectionPoint.BeforePostProcess)
return false;

return true;
}

void DoFilters(ref Rect rect)
{
m_FilterFoldout.boolValue = EditorGUI.Foldout(rect, m_FilterFoldout.boolValue, Styles.filtersHeader, true);
Expand Down Expand Up @@ -296,9 +321,11 @@ protected override float GetPassHeight(SerializedProperty customPass)
{
float height = Styles.defaultLineSpace;

height += ShowMsaaObjectInfo() ? Styles.helpBoxHeight : 0;

if (m_FilterFoldout.boolValue)
{
height *= m_FilterLines;
height += Styles.defaultLineSpace * m_FilterLines;
height += ShowOpaqueObjectWarning() ? Styles.helpBoxHeight : 0;
}

Expand Down
Loading