Skip to content

Commit d40dce3

Browse files
sebastienlagardeFrancescoC-unityfredericv-unity3dAntoine LelievreRSlysz
authored
Merge 7.x.x/hd/staging (#1796)
* Pre warm RT Handle system so that reallocations are reduced. * Fixed blend distance editing (1248931) #838 * Fix custom pass after post process buffer #1072 * Find the appropriate default frame settings per editor (case 1247631) #1129 * Hdrp/fix hierarchicalbox gizmo symetry and homothety mode ensuring face faces outside #1228 * Remove MSAA debug mode when renderpipeline asset has no MSAA #1289 * Bugfix for HDRenderPipelineAsset getting set to null when running unity in batchmode, resulting in broken builds. (#1696) Co-authored-by: pastasfuture <[email protected]> * Fix compilation issue when XR is not available #1391 * Fixed an issue where only one of the two lookdev views would update when changing the default lookdev volume profile. #1529 * Added propagating nans doc (#1562) * Added propagating nans doc * Added information about HDRP's NanTracker * GFXGI-237: Force update for static skies when camera type is set to S… #1570 * Fixing the remapping of Min/Max parametrizations values to Amplitude parametrizations values * Updating UI to match documentation of LayeredLit * Hdrp/fix/terrain layer parametrization #1678 * Update HDRenderPipeline.LookDev.cs (#1740) * Added information about HDRP not upgrading particle shaders (#1601) * Added information about HDRP not upgrading particle shaders * Update Upgrading-To-HDRP.md * Update Upgrading-To-HDRP.md * Changed cog to gear to adhere to style guide rules #1611 * Added build settings setup (#1631) * Hdrp/docs/shader additions #1580 * Fix XR multipass #1133 * Fix Screen position out of view frustum issues when planar reflection probe is at same camera location #1537 * Update Layered-Lit-Shader #1766 * Fix for assertion on undoing a mod of diffuse profile list with volume profile deleted #1769 * Fixed two issues with sky static lighting. #1775 * [8.x.x backport] Fix issues with history sampling and hw dynamic res #1777 * fixed changelog * Fix for potentially corrupted refraction result on xbox #1699 Co-authored-by: FrancescoC-unity <[email protected]> Co-authored-by: fredericv-unity3d <[email protected]> Co-authored-by: Antoine Lelievre <[email protected]> Co-authored-by: Remi Slysz <[email protected]> Co-authored-by: Adrien de Tocqueville <[email protected]> Co-authored-by: Nicholas Brancaccio <[email protected]> Co-authored-by: pastasfuture <[email protected]> Co-authored-by: JulienIgnace-Unity <[email protected]> Co-authored-by: JordanL8 <[email protected]> Co-authored-by: Ben Spencer <[email protected]> Co-authored-by: Jean-Philippe Grenier <[email protected]> Co-authored-by: Fabien Houlmann <[email protected]>
1 parent 855c738 commit d40dce3

File tree

10 files changed

+59
-13
lines changed

10 files changed

+59
-13
lines changed

com.unity.render-pipelines.core/Editor/Volume/VolumeComponentListEditor.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,14 @@ void OnUndoRedoPerformed()
119119

120120
// Dumb hack to make sure the serialized object is up to date on undo (else there'll be
121121
// a state mismatch when this class is used in a GameObject inspector).
122-
m_SerializedObject.Update();
123-
m_SerializedObject.ApplyModifiedProperties();
122+
if (m_SerializedObject != null
123+
&& !m_SerializedObject.Equals(null)
124+
&& m_SerializedObject.targetObject != null
125+
&& !m_SerializedObject.targetObject.Equals(null))
126+
{
127+
m_SerializedObject.Update();
128+
m_SerializedObject.ApplyModifiedProperties();
129+
}
124130

125131
// Seems like there's an issue with the inspector not repainting after some undo events
126132
// This will take care of that

com.unity.render-pipelines.core/Runtime/Textures/RTHandleSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void SetReferenceSize(int width, int height, MSAASamples msaaSamples)
161161
lastFrameMaxSize = new Vector2(GetMaxWidth(), GetMaxHeight());
162162
}
163163

164-
if (DynamicResolutionHandler.instance.HardwareDynamicResIsEnabled())
164+
if (DynamicResolutionHandler.instance.HardwareDynamicResIsEnabled() && m_HardwareDynamicResRequested)
165165
{
166166
m_RTHandleProperties.rtHandleScale = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
167167
}

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1717
- Fixed issue that failed compilation when XR is disabled.
1818
- Fixed an issue where only one of the two lookdev views would update when changing the default lookdev volume profile
1919
- Fix Amplitude -> Min/Max parametrization conversion
20-
20+
- Fixed sky asserts with XR multipass
21+
- Fixed "Screen position out of view frustum" error when camera is at exactly the planar reflection probe location.
22+
- Fixed issue when undoing a change in diffuse profile list after deleting the volume profile.
23+
- Fixed a static lighting flickering issue caused by having an active planar probe in the scene while rendering inspector preview.
24+
- Fixed an issue where even when set to OnDemand, the sky lighting would still be updated when changing sky parameters.
25+
- Fixed TAA issue and hardware dynamic resolution.
26+
- Fixed warning with area mesh (case 1268379)
27+
- Fixed an issue that lead to corrupted refraction in some scenarios on xbox.
28+
2129
### Changed
2230
- The `CustomPassLoadCameraColor` and `CustomPassSampleCameraColor` functions now returns the correct color buffer when used in after post process instead of the color pyramid (which didn't had post processes).
2331

com.unity.render-pipelines.high-definition/Documentation~/Layered-Lit-Shader.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ Unity exposes up to four Material layers for you to use in your Layered Material
9090
| **Smoothness Remapping** | Use this min-max slider to remap the smoothness values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.<br />This property only appears when you assign a **Mask Map**. |
9191
| **Ambient Occlusion Remapping** | Use this min-max slider to remap the ambient occlusion values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.<br />This property only appears when you assign a **Mask Map**. |
9292
| **Mask Map** | Assign a [channel-packed Texture](Glossary.html#ChannelPacking) with the following Material maps in its RGBA channels.<br />&#8226; **Red**: Stores the metallic map. <br />&#8226; **Green**: Stores the ambient occlusion map.<br />&#8226; **Blue**: Stores the detail mask map.<br />&#8226; **Alpha**: Stores the smoothness map.<br />For more information on channel-packed Textures and the mask map, see [mask map](Mask-Map-and-Detail-Map.html#MaskMap). |
93-
| **Normal Map Space** | Use this drop-down to select the type of Normal Map space that this Material uses.**TangentSpace**: Defines the normal map in UV space; use this to tile a Texture on a Mesh. The normal map Texture must be BC7, BC5, or DXT5nm format. **ObjectSpace**: Defines the normal maps in world space. Use this for planar-mapping objects like the terrain. The normal map must be an RGB Texture . |
93+
| **Normal Map Space** | Use this drop-down to select the type of Normal Map space that this Material uses.<br />&#8226; **TangentSpace**: Defines the normal map in UV space; use this to tile a Texture on a Mesh. The normal map Texture must be BC7, BC5, or DXT5nm format.<br />&#8226; **ObjectSpace**: Defines the normal maps in world space. Use this for planar-mapping objects like the terrain. The normal map must be an RGB Texture . |
9494
| **Normal Map** | Assign a Texture that defines the normal map for this Material in tangent space. Use the slider to modulate the normal intensity between 0 and 8.<br />This property only appears when you select **TangentSpace** from the **Normal Map Space** drop-down. |
9595
| **Normal Map OS** | Assign a Texture that defines the object space normal map for this Material. Use the handle to modulate the normal intensity between 0 and 8.<br />This property only appears when you select **ObjectSpace** from the **Normal Map Space** drop-down. |
9696
| **Bent Normal Map** | Assign a Texture that defines the bent normal map for this Material in tangent space. HDRP uses bent normal maps to simulate more accurate ambient occlusion. Note: Bent normal maps only work with diffuse lighting.<br />This property only appears when you select **TangentSpace** from the **Normal Map Space** drop-down.. |
9797
| **Bent Normal Map OS** | Assign a Texture that defines the bent normal map for this Material in object space. HDRP uses bent normal maps to simulate more accurate ambient occlusion. Note: Bent normal maps only work with diffuse lighting.<br />This property only appears when you select **ObjectSpace** from the **Normal Map Space** drop-down. |
9898
| **Height Map** | Assign a Texture that defines the heightmap for this Material. Unity uses this map to blend this layer. |
99-
| **- Parametrization** | Use the drop-down to select the parametrization method for the to use for the **Height Map**.**Min/Max**: HDRP compares the **Min** and **Max** value to calculate the peak, trough, and base position of the heightmap. If the **Min** is -1 and the **Max** is 3, then the base is at the Texture value 0.25. This uses the full range of the heightmap.**Amplitude**: Allows you to manually set the amplitude and base position of the heightmap. This uses the full range of the heightmap. |
99+
| **- Parametrization** | Use the drop-down to select the parametrization method for the to use for the **Height Map**.<br />&#8226; **Min/Max**: HDRP compares the **Min** and **Max** value to calculate the peak, trough, and base position of the heightmap. If the **Min** is -1 and the **Max** is 3, then the base is at the Texture value 0.25. This uses the full range of the heightmap.<br />&#8226; **Amplitude**: Allows you to manually set the amplitude and base position of the heightmap. This uses the full range of the heightmap. In this mode, **Amplitude** sets the range of values and **Base** defines how far through the range the zero value (base) is. For example, if **Amplitude** is 100 and **Base** is 0.5 (the default value), the minimum value is -50 and the maximum value if 50. If you then set **Base** to 0, the minimum value becomes 0 and the maximum value becomes 100. |
100100
| **- Min** | Set the minimum value in the **Height Map**. |
101101
| **- Max** | Set the maximum value in the **Height Map**. |
102102
| **- Offset** | Set the offset that HDRP applies to the **Height Map**. |
103-
| **- Amplitude** | Set the amplitude of the **Height Map**. |
104-
| **- Base** | Use the slider to set the base for the **Height Map**. |
105-
| **Base UV Mapping** | Use the drop-down to select the type of UV mapping that HDRP uses to map Textures to this Material’s surface.Unity manages four UV channels for a vertex: **UV0**, **UV1**, **UV2**, and **UV3**.**Planar:** A planar projection from top to bottom. **Triplanar**: A planar projection in three directions:X-axis: Left to rightY-axis: Top to bottomZ-axis: Front to back Unity blends these three projections together to produce the final result. |
103+
| **- Amplitude** | Set the amplitude of the **Height Map**. This is the range of values the height map represents. |
104+
| **- Base** | Use the slider to set the base for the **Height Map**. This is the value of the level 0 in the height map. If you set this to 0.5 and set **Amplitude** to 100, the minimum value is -50 and the maximum value is 50. |
105+
| **Base UV Mapping** | Use the drop-down to select the type of UV mapping that HDRP uses to map Textures to this Material’s surface.<br />&#8226; Unity manages four UV channels for a vertex: **UV0**, **UV1**, **UV2**, and **UV3**.<br />&#8226; **Planar:** A planar projection from top to bottom.<br />&#8226; **Triplanar**: A planar projection in three directions:X-axis: Left to rightY-axis: Top to bottomZ-axis: Front to back Unity blends these three projections together to produce the final result. |
106106
| **Tiling** | Set an **X** and **Y** UV tile rate for all of the Textures in the **Surface Inputs** section. HDRP uses the **X** and **Y** values to tile these Textures across the Material’s surface, in object space. |
107107
| **Offset** | Set an **X** and **Y** UV offset for all of the Textures in the **Surface Inputs** section. HDRP uses the **X** and **Y** values to offset these Textures across the Material’s surface, in object. |
108108

@@ -128,7 +128,7 @@ Unity exposes up to four Material layers for you to use in your Layered Material
128128
| **Emission UV Mapping** | Use the drop-down to select the type of UV mapping that HDRP uses for the **Emission Map**.• Unity manages four UV channels for a vertex: **UV0**, **UV1**, **UV2**, and **UV3**.• **Planar:** A planar projection from top to bottom.• **Triplanar**: A planar projection in three directions:X-axis: Left to rightY-axis: Top to bottomZ-axis: Front to back Unity blends these three projections together to produce the final result. |
129129
| **- Tiling** | Set an **X** and **Y** tile rate for the **Emission Map** UV. HDRP uses the **X** and **Y** values to tile the Texture assigned to the **Emission Map** across the Material’s surface, in object space. |
130130
| **- Offset** | Set an **X** and **Y** offset for the **Emission Map** UV. HDRP uses the **X** and **Y** values to offset the Texture assigned to the **Emission Map** across the Material’s surface, in object space. |
131-
| **Emission Intensity** | Set the overall strength of the emission effect for this Material.Use the drop-down to select one of the following [physical light units](Physical-Light-Units.html) to use for intensity:[Nits](Physical-Light-Units.html#Nits)[EV<sub>100</sub>](Physical-Light-Units.html#EV) |
131+
| **Emission Intensity** | Set the overall strength of the emission effect for this Material.Use the drop-down to select one of the following [physical light units](Physical-Light-Units.md) to use for intensity:<br />&#8226; [Nits](Physical-Light-Units.md#Nits)<br />&#8226; [EV<sub>100</sub>](Physical-Light-Units.md#EV) |
132132
| **Exposure Weight** | Use the slider to set how much effect the exposure has on the emission power. For example, if you create a neon tube, you would want to apply the emissive glow effect at every exposure. |
133133
| **Emission Multiply with Base** | Enable the checkbox to make HDRP use the base color of the Material when it calculates the final color of the emission. When enabled, HDRP multiplies the emission color by the base color to calculate the final emission color. |
134134
| **Emission** | Toggles whether emission affects global illumination. |

com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,7 @@ internal void ForceRenderingNextUpdate()
437437

438438
void UpdateProbeName()
439439
{
440-
// TODO: ask if this is ok:
441-
if (settings.type == ProbeSettings.ProbeType.PlanarProbe)
440+
if (settings.type == ProbeSettings.ProbeType.ReflectionProbe)
442441
{
443442
for (int i = 0; i < 6; i++)
444443
probeName[i] = $"Reflection Probe RenderCamera ({name}: {(CubemapFace)i})";

com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ float IntersectSphereProxy(EnvLightData lightData, float3 dirPS, float3 position
2727
{
2828
float sphereOuterDistance = lightData.proxyExtents.x;
2929
float projectionDistance = IntersectRaySphereSimple(positionPS, dirPS, sphereOuterDistance);
30+
projectionDistance = IsNaN(projectionDistance) ? -1.0f : projectionDistance; // Note that because we use IntersectRaySphereSimple, in case of a ill-set proxy, it could be that
31+
// the determinant in the ray-sphere intersection code ends up negative, leading to a NaN.
32+
// Rather than complicating the IntersectRaySphereSimple or switching to a more complex case, we cover that case this way.
3033
projectionDistance = max(projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape)
3134

3235
return projectionDistance;

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,7 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c
13471347
cullingResults = req.cullingResults;
13481348
skipClearCullingResults.Add(req.index);
13491349
needCulling = false;
1350+
m_SkyManager.UpdateCurrentSkySettings(hdCamera);
13501351
}
13511352
}
13521353
}

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,13 @@ internal static void Sanitize(ref FrameSettings sanitizedFrameSettings, Camera c
699699
// When MSAA is enabled we disable Fptl as it become expensive compare to cluster
700700
// In HD, MSAA is only supported for forward only rendering, no MSAA in deferred mode (for code complexity reasons)
701701
sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.FPTLForForwardOpaque] &= !msaa;
702+
703+
// We disable reflection probes and planar reflections in regular preview rendering for two reasons.
704+
// - Performance: Realtime reflection are 99% not necessary in previews
705+
// - Static lighting consistency: When rendering a planar probe from a preview camera it may induce a recomputing of the static lighting
706+
// but with the preview lights which are different from the ones in the scene and will change the result inducing flickering.
707+
sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.ReflectionProbe] &= !preview;
708+
sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.PlanarProbe] &= !preview;
702709
}
703710

704711
/// <summary>Aggregation is default with override of the renderer then sanitized depending on supported features of hdrpasset.</summary>

com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,18 @@ public void UpdateEnvironment( HDCamera hdCamera,
727727
m_BuiltinParameters.frameIndex = frameIndex;
728728
m_BuiltinParameters.skySettings = skyContext.skySettings;
729729

730+
// When update is not requested and the context is already valid (ie: already computed at least once),
731+
// we need to early out in two cases:
732+
// - updateMode is "OnDemand" in which case we never update unless explicitly requested
733+
// - updateMode is "Realtime" in which case we only update if the time threshold for realtime update is passed.
734+
if (IsCachedContextValid(skyContext) && !updateRequired)
735+
{
736+
if (skyContext.skySettings.updateMode.value == EnvironmentUpdateMode.OnDemand)
737+
return;
738+
else if (skyContext.skySettings.updateMode.value == EnvironmentUpdateMode.Realtime && skyContext.currentUpdateTime < skyContext.skySettings.updatePeriod.value)
739+
return;
740+
}
741+
730742
int skyHash = ComputeSkyHash(hdCamera, skyContext, sunLight, ambientMode, staticSky);
731743
bool forceUpdate = updateRequired;
732744

@@ -745,6 +757,7 @@ public void UpdateEnvironment( HDCamera hdCamera,
745757
{
746758
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.UpdateSkyEnvironment)))
747759
{
760+
// Debug.Log("Update Sky Lighting");
748761
RenderSkyToCubemap(skyContext);
749762

750763
if (updateAmbientProbe)
@@ -823,7 +836,7 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC
823836
if ((ambientMode == SkyAmbientMode.Static || forceStaticUpdate) && hdCamera.camera.cameraType != CameraType.Preview)
824837
{
825838
m_StaticLightingSky.skySettings = staticLightingSky != null ? staticLightingSky.skySettings : null;
826-
UpdateEnvironment(hdCamera, renderContext, m_StaticLightingSky, sunLight, m_StaticSkyUpdateRequired, true, true, SkyAmbientMode.Static, frameIndex, cmd);
839+
UpdateEnvironment(hdCamera, renderContext, m_StaticLightingSky, sunLight, m_StaticSkyUpdateRequired || m_UpdateRequired, true, true, SkyAmbientMode.Static, frameIndex, cmd);
827840
m_StaticSkyUpdateRequired = false;
828841
}
829842

com.unity.render-pipelines.high-definition/Runtime/Utilities/ProbeCapturePositionSettings.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ static ProbeCapturePositionSettings ComputeFrom(
160160
var result = new ProbeCapturePositionSettings();
161161
var proxyToWorld = probe.proxyToWorld;
162162
result.proxyPosition = proxyToWorld.GetColumn(3);
163+
164+
// If reference position and proxy position is exactly the same, we end up in some degeneracies triggered
165+
// by engine code when computing culling parameters. This is an extremely rare case, but can happen
166+
// in editor when focusing on the planar probe. So if that happens, we offset them 0.1 mm apart.
167+
if(Vector3.Distance(result.proxyPosition, referencePosition) < 1e-4f)
168+
{
169+
referencePosition += new Vector3(1e-4f, 1e-4f, 1e-4f);
170+
}
171+
163172
result.proxyRotation = proxyToWorld.rotation;
164173
result.referencePosition = referencePosition;
165174
result.referenceRotation = referenceRotation;

0 commit comments

Comments
 (0)