Skip to content

Commit 0c43a5a

Browse files
Merge branch 'master' into HDRP/sg-vfx-integration-improved-to-urp
2 parents 7721e4b + bf95172 commit 0c43a5a

File tree

7 files changed

+55
-6
lines changed

7 files changed

+55
-6
lines changed

com.unity.render-pipelines.core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The version number for this package has increased due to a version update of a r
4949
- Added an option to change the visibilty of the Volumes Gizmos (Solid, Wireframe, Everything), available at Preferences > Core Render Pipeline
5050
- Added class for drawing shadow cascades `UnityEditor.Rendering.ShadowCascadeGUI.DrawShadowCascades`.
5151
- Added UNITY_PREV_MATRIX_M and UNITY_PREV_MATRIX_I_M shader macros to support instanced motion vector rendering
52+
- Added new API to customize the rtHandleProperties of a particular RTHandle. This is a temporary work around to assist with viewport setup of Custom post process when dealing with DLSS or TAAU
5253

5354
### Fixed
5455
- Help boxes with fix buttons do not crop the label.

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,29 @@ public class RTHandle
1919
internal bool m_EnableHWDynamicScale = false;
2020
internal string m_Name;
2121

22+
internal bool m_UseCustomHandleScales = false;
23+
internal RTHandleProperties m_CustomHandleProperties;
24+
25+
/// <summary>
26+
/// By default, rtHandleProperties gets the global state of scalers against the global reference mode.
27+
/// This method lets the current RTHandle use a local custom RTHandleProperties. This function is being used
28+
/// by scalers such as TAAU and DLSS, which require to have a different resolution for color (independent of the RTHandleSystem).
29+
/// </summary>
30+
/// <param name="properties">Properties to set.</param>
31+
public void SetCustomHandleProperties(in RTHandleProperties properties)
32+
{
33+
m_UseCustomHandleScales = true;
34+
m_CustomHandleProperties = properties;
35+
}
36+
37+
/// <summary>
38+
/// Method that clears any custom handle property being set.
39+
/// </summary>
40+
public void ClearCustomHandleProperties()
41+
{
42+
m_UseCustomHandleScales = false;
43+
}
44+
2245
/// <summary>
2346
/// Scale factor applied to the RTHandle reference size.
2447
/// </summary>
@@ -34,9 +57,9 @@ public class RTHandle
3457
/// </summary>
3558
public Vector2Int referenceSize { get; internal set; }
3659
/// <summary>
37-
/// Current properties of the RTHandle System
60+
/// Current properties of the RTHandle System. If a custom property has been set through SetCustomHandleProperties method, it will be used that one instead.
3861
/// </summary>
39-
public RTHandleProperties rtHandleProperties { get { return m_Owner.rtHandleProperties; } }
62+
public RTHandleProperties rtHandleProperties { get { return m_UseCustomHandleScales ? m_CustomHandleProperties : m_Owner.rtHandleProperties; } }
4063
/// <summary>
4164
/// RenderTexture associated with the RTHandle
4265
/// </summary>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
390390
- Fixed wrong ordering in FrameSettings (Normalize Reflection Probes)
391391
- Fixed ThreadMapDetail to saturate AO & smoothness strength inputs to prevent out-of-bounds values set by users (1357740)
392392
- Allow negative wind speed parameter.
393+
- Viewport and scaling of Custom post process when TAAU or DLSS are enabled (case 1352407).
393394

394395
### Changed
395396
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,8 @@ class CustomPostProcessData
13641364
public TextureHandle motionVecTexture;
13651365
public HDCamera hdCamera;
13661366
public CustomPostProcessVolumeComponent customPostProcess;
1367+
public Vector4 postProcessScales;
1368+
public Vector2Int postProcessViewportSize;
13671369
}
13681370

13691371
bool DoCustomPostProcess(RenderGraph renderGraph, HDCamera hdCamera, ref TextureHandle source, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, List<string> postProcessList)
@@ -1398,19 +1400,39 @@ bool DoCustomPostProcess(RenderGraph renderGraph, HDCamera hdCamera, ref Texture
13981400
passData.motionVecTexture = builder.ReadTexture(motionVectors);
13991401

14001402
passData.source = builder.ReadTexture(source);
1401-
passData.destination = builder.UseColorBuffer(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true)
1403+
passData.destination = builder.UseColorBuffer(renderGraph.CreateTexture(new TextureDesc(Vector2.one, IsDynamicResUpscaleTargetEnabled(), true)
14021404
{ colorFormat = GetPostprocessTextureFormat(), enableRandomWrite = true, name = "CustomPostProcesDestination" }), 0);
14031405
passData.hdCamera = hdCamera;
14041406
passData.customPostProcess = customPP;
1407+
passData.postProcessScales = new Vector4(hdCamera.postProcessRTScales.x, hdCamera.postProcessRTScales.y, hdCamera.postProcessRTScalesHistory.x, hdCamera.postProcessRTScalesHistory.y);
1408+
passData.postProcessViewportSize = postProcessViewportSize;
14051409
builder.SetRenderFunc(
14061410
(CustomPostProcessData data, RenderGraphContext ctx) =>
14071411
{
1412+
var srcRt = (RTHandle)data.source;
1413+
var dstRt = (RTHandle)data.destination;
1414+
1415+
// HACK FIX: for custom post process, we want the user to transparently be able to use color target regardless of the scaling occured. For example, if the user uses any of the HDUtil blit methods
1416+
// which require the rtHandleProperties to set the viewport and sample scales.
1417+
// In the case of DLSS and TAAU, the post process viewport and size for the color target have changed, thus we override them here.
1418+
// When these upscalers arent set, behaviour is still the same (since the post process scale is the same as the global rt handle scale). So for simplicity, we always take this code path for custom post process color.
1419+
var newProps = srcRt.rtHandleProperties;
1420+
newProps.rtHandleScale = data.postProcessScales;
1421+
newProps.currentRenderTargetSize = data.postProcessViewportSize;
1422+
newProps.previousRenderTargetSize = data.postProcessViewportSize;
1423+
newProps.currentViewportSize = data.postProcessViewportSize;
1424+
srcRt.SetCustomHandleProperties(newProps);
1425+
dstRt.SetCustomHandleProperties(newProps);
1426+
14081427
// Temporary: see comment above
14091428
ctx.cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, data.depthBuffer);
14101429
ctx.cmd.SetGlobalTexture(HDShaderIDs._NormalBufferTexture, data.normalBuffer);
14111430
ctx.cmd.SetGlobalTexture(HDShaderIDs._CameraMotionVectorsTexture, data.motionVecTexture);
14121431

14131432
data.customPostProcess.Render(ctx.cmd, data.hdCamera, data.source, data.destination);
1433+
1434+
srcRt.ClearCustomHandleProperties();
1435+
dstRt.ClearCustomHandleProperties();
14141436
});
14151437

14161438
customPostProcessExecuted = true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ internal void SetupAmbientProbe(HDCamera hdCamera)
537537
RenderSettings.ambientIntensity = 1.0f;
538538
RenderSettings.ambientMode = AmbientMode.Skybox; // Force skybox for our HDRI
539539
RenderSettings.reflectionIntensity = 1.0f;
540-
RenderSettings.customReflection = null;
540+
RenderSettings.customReflectionTexture = null;
541541
}
542542

543543
void BlitCubemap(CommandBuffer cmd, Cubemap source, RenderTexture dest)
@@ -1254,7 +1254,7 @@ void OnBakeStarted()
12541254
RenderSettings.ambientIntensity = 1.0f;
12551255
RenderSettings.ambientMode = AmbientMode.Skybox; // Force skybox for our HDRI
12561256
RenderSettings.reflectionIntensity = 1.0f;
1257-
RenderSettings.customReflection = null;
1257+
RenderSettings.customReflectionTexture = null;
12581258

12591259
DynamicGI.UpdateEnvironment();
12601260
}

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ The version number for this package has increased due to a version update of a r
101101
- Exposed Parameter placement can be moved after sanitize
102102
- Fix rendering artifacts on some mobile devices [Case 1149057](https://issuetracker.unity3d.com/product/unity/issues/guid/1149057/)
103103
- Fix compilation failure on OpenGLES [Case 1348666](https://issuetracker.unity3d.com/product/unity/issues/guid/1348666/)
104+
- Don't open an empty VFX Graph Editor when assigning a VFX Asset to a Visual Effect GameObject from the inspector [Case 1347399](https://issuetracker.unity3d.com/product/unity/issues/guid/1347399/)
105+
- Visual Effect inspector input fields don't lose focus anymore while typing (Random seed)
104106

105107
## [11.0.0] - 2020-10-21
106108
### Added

com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ public override void OnInspectorGUI()
801801
EditorGUI.indentLevel = 0;
802802
if (serializedObject.ApplyModifiedProperties())
803803
{
804-
var window = EditorWindow.GetWindow<VFXViewWindow>();
804+
var window = WindowLayout.FindEditorWindowOfType(typeof(VFXViewWindow)) as VFXViewWindow;
805805
if (window != null)
806806
window.OnVisualEffectComponentChanged(targets.Cast<VisualEffect>());
807807
}

0 commit comments

Comments
 (0)