Skip to content

Commit 90b984b

Browse files
author
Unity Technologies
committed
com.unity.postprocessing@3.2.1
## [3.2.1] - 2022-01-12 ### Fixed - Fixed missing XR warnings for XR non-friendly effects when using XR plugins (case 1328062) - Fixed rendering artifacts when depth buffer is used after screen space reflections pass on iOS and M1 (case 1341052) - Fixed compilation error when built-in VR module is disabled (case 1389160) - Fixed bug where alpha could not be used with HDR on mobile (case 1387848). HDR texture format is now set from Graphics Tier Settings when using Unity 2019.3 or newer. - Fixed incorrect Screen-space Reflections rendering on OpenGL platforms (case 1368370)
1 parent 8ce9b69 commit 90b984b

13 files changed

Lines changed: 77 additions & 18 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [3.2.1] - 2022-01-12
8+
9+
### Fixed
10+
- Fixed missing XR warnings for XR non-friendly effects when using XR plugins (case 1328062)
11+
- Fixed rendering artifacts when depth buffer is used after screen space reflections pass on iOS and M1 (case 1341052)
12+
- Fixed compilation error when built-in VR module is disabled (case 1389160)
13+
- Fixed bug where alpha could not be used with HDR on mobile (case 1387848). HDR texture format is now set from Graphics Tier Settings when using Unity 2019.3 or newer.
14+
- Fixed incorrect Screen-space Reflections rendering on OpenGL platforms (case 1368370)
15+
716
## [3.2.0] - 2021-11-15
817

918
### Fixed

PostProcessing/Editor/Effects/BloomEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override void OnInspectorGUI()
5454
PropertyField(m_DirtTexture);
5555
PropertyField(m_DirtIntensity);
5656

57-
if (RuntimeUtilities.isVREnabled)
57+
if (EditorUtilities.isVREnabled)
5858
{
5959
if ((m_DirtIntensity.overrideState.boolValue && m_DirtIntensity.value.floatValue > 0f)
6060
|| (m_DirtTexture.overrideState.boolValue && m_DirtTexture.value.objectReferenceValue != null))

PostProcessing/Editor/Effects/LensDistortionEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ internal sealed class LensDistortionEditor : DefaultPostProcessEffectEditor
77
{
88
public override void OnInspectorGUI()
99
{
10-
if (RuntimeUtilities.isVREnabled)
10+
if (EditorUtilities.isVREnabled)
1111
EditorGUILayout.HelpBox("Lens Distortion is available only for non-stereo cameras.", MessageType.Warning);
1212

1313
base.OnInspectorGUI();

PostProcessing/Editor/Effects/MotionBlurEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ internal sealed class MotionBlurEditor : DefaultPostProcessEffectEditor
77
{
88
public override void OnInspectorGUI()
99
{
10-
if (RuntimeUtilities.isVREnabled)
10+
if (EditorUtilities.isVREnabled)
1111
EditorGUILayout.HelpBox("Motion Blur is available only for non-stereo cameras.", MessageType.Warning);
1212

1313
base.OnInspectorGUI();
Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"name": "Unity.Postprocessing.Editor",
3+
"rootNamespace": "",
34
"references": [
4-
"Unity.Postprocessing.Runtime"
5+
"Unity.Postprocessing.Runtime",
6+
"Unity.XR.Management",
7+
"Unity.XR.Management.Editor"
58
],
6-
"optionalUnityReferences": [],
79
"includePlatforms": [
810
"Editor"
911
],
@@ -12,5 +14,23 @@
1214
"overrideReferences": false,
1315
"precompiledReferences": [],
1416
"autoReferenced": true,
15-
"defineConstraints": []
16-
}
17+
"defineConstraints": [],
18+
"versionDefines": [
19+
{
20+
"name": "com.unity.xr.management",
21+
"expression": "4.0.1",
22+
"define": "XR_MANAGEMENT_4_0_1_OR_NEWER"
23+
},
24+
{
25+
"name": "com.unity.modules.vr",
26+
"expression": "1.0.0",
27+
"define": "ENABLE_VR_MODULE"
28+
},
29+
{
30+
"name": "com.unity.modules.xr",
31+
"expression": "1.0.0",
32+
"define": "ENABLE_XR_MODULE"
33+
}
34+
],
35+
"noEngineReferences": false
36+
}

PostProcessing/Editor/Utils/EditorUtilities.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
using UnityEngine.Assertions;
66
using UnityEngine.Rendering.PostProcessing;
77

8+
#if XR_MANAGEMENT_4_0_1_OR_NEWER
9+
using UnityEditor.XR.Management;
10+
#endif
11+
812
namespace UnityEditor.Rendering.PostProcessing
913
{
1014
/// <summary>
@@ -360,5 +364,28 @@ static bool CanPaste(PostProcessEffectSettings target)
360364
return s_ClipboardContent != null
361365
&& s_ClipboardContent.GetType() == target.GetType();
362366
}
367+
368+
internal static bool isVREnabled
369+
{
370+
get
371+
{
372+
#if ENABLE_VR_MODULE && ENABLE_VR
373+
#if ENABLE_XR_MODULE && XR_MANAGEMENT_4_0_1_OR_NEWER
374+
// If XR manager extension is available, we can query it to know if any XR extension is currently active
375+
var buildTargetSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildTargetGroup.Standalone);
376+
return (buildTargetSettings != null && buildTargetSettings.AssignedSettings != null &&
377+
buildTargetSettings.AssignedSettings.activeLoaders.Count > 0);
378+
#elif !UNITY_2020_1_OR_NEWER
379+
// This will only work with 2019.3 and older since it rely on the old VR module
380+
return UnityEditorInternal.VR.VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget));
381+
#else
382+
// If we reach this code-path, it means we can't really detect if VR/XR is active in the Editor, so return false
383+
return false;
384+
#endif
385+
#else
386+
return false;
387+
#endif
388+
}
389+
}
363390
}
364391
}

PostProcessing/Runtime/Effects/ScreenSpaceReflections.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ public override void Render(PostProcessRenderContext context)
260260

261261
sheet.properties.SetMatrix(ShaderIDs.ViewMatrix, context.camera.worldToCameraMatrix);
262262
sheet.properties.SetMatrix(ShaderIDs.InverseViewMatrix, context.camera.worldToCameraMatrix.inverse);
263-
sheet.properties.SetMatrix(ShaderIDs.InverseProjectionMatrix, projectionMatrix.inverse);
264263
sheet.properties.SetMatrix(ShaderIDs.ScreenSpaceProjectionMatrix, screenSpaceProjectionMatrix);
265264
sheet.properties.SetVector(ShaderIDs.Params, new Vector4((float)settings.vignette.value, settings.distanceFade.value, settings.maximumMarchDistance.value, lodCount));
266265
sheet.properties.SetVector(ShaderIDs.Params2, new Vector4((float)context.width / (float)context.height, (float)size / (float)noiseTex.width, settings.thickness.value, settings.maximumIterationCount.value));
@@ -329,7 +328,7 @@ public override void Render(PostProcessRenderContext context)
329328
cmd.ReleaseTemporaryRT(m_MipIDs[i]);
330329

331330
sheet.properties.SetTexture(ShaderIDs.Resolve, m_Resolve);
332-
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, (int)Pass.Composite);
331+
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, (int)Pass.Composite, preserveDepth: true);
333332
cmd.EndSample("Screen-space Reflections");
334333
}
335334

PostProcessing/Runtime/PostProcessDebugLayer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,10 @@ internal void RenderSpecialOverlays(PostProcessRenderContext context)
328328
var sheet = context.propertySheets.Get(context.resources.shaders.debugOverlays);
329329
sheet.ClearKeywords();
330330

331+
#if !UNITY_2022_1_OR_NEWER
331332
if (context.camera.actualRenderingPath == RenderingPath.DeferredLighting)
332333
sheet.EnableKeyword("SOURCE_GBUFFER");
334+
#endif
333335

334336
PushDebugOverlay(context.command, BuiltinRenderTextureType.None, sheet, 1);
335337
}

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ void OnPostRender()
713713
{
714714
// The camera must be reset on precull and post render to avoid issues with alpha when toggling TAA.
715715
m_Camera.ResetProjectionMatrix();
716+
#if (ENABLE_VR_MODULE && ENABLE_VR)
716717
if (m_CurrentContext.stereoActive)
717718
{
718719
if (RuntimeUtilities.isSinglePassStereoEnabled || m_Camera.stereoActiveEye == Camera.MonoOrStereoscopicEye.Right)
@@ -723,6 +724,7 @@ void OnPostRender()
723724
m_Camera.projectionMatrix = m_Camera.GetStereoProjectionMatrix(Camera.StereoscopicEye.Left);
724725
}
725726
}
727+
#endif
726728
}
727729
}
728730
}

PostProcessing/Runtime/Utils/RuntimeUtilities.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,16 +865,16 @@ public static RenderTextureFormat defaultHDRRenderTextureFormat
865865
{
866866
get
867867
{
868-
#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR
868+
#if !UNITY_2019_3_OR_NEWER && (UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_EDITOR)
869869
RenderTextureFormat format = RenderTextureFormat.RGB111110Float;
870870
#if UNITY_EDITOR
871871
var target = EditorUserBuildSettings.activeBuildTarget;
872-
if (target != BuildTarget.Android && target != BuildTarget.iOS && target != BuildTarget.tvOS && target != BuildTarget.Switch)
872+
if (target != BuildTarget.Android && target != BuildTarget.iOS && target != BuildTarget.tvOS)
873873
return RenderTextureFormat.DefaultHDR;
874874
#endif // UNITY_EDITOR
875875
if (format.IsSupported())
876876
return format;
877-
#endif // UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR
877+
#endif // #if !UNITY_2019_3_OR_NEWER && (UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_EDITOR)
878878
return RenderTextureFormat.DefaultHDR;
879879
}
880880
}

0 commit comments

Comments
 (0)