Skip to content

Commit 4b012d2

Browse files
Merge pull request #8291 from Unity-Technologies/internal/6000.0/staging
Mirror Internal/6000.0/staging
2 parents f91d927 + 7498b18 commit 4b012d2

29 files changed

Lines changed: 1786 additions & 90 deletions

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,11 @@ private void InternalNVIDIARender(in DLSSPass.Parameters parameters, UpscalerRes
526526
: parameters.drsSettings.DLSSSharpness;
527527

528528
dlssViewData.inputRes = new UpscalerResolution() { width = (uint)parameters.hdCamera.actualWidth, height = (uint)parameters.hdCamera.actualHeight };
529-
dlssViewData.outputRes = new UpscalerResolution() { width = (uint)DynamicResolutionHandler.instance.finalViewport.x, height = (uint)DynamicResolutionHandler.instance.finalViewport.y };
530-
529+
dlssViewData.outputRes = new UpscalerResolution() {
530+
width = (uint)parameters.hdCamera.finalViewport.width,
531+
height = (uint)parameters.hdCamera.finalViewport.height
532+
};
533+
531534
dlssViewData.jitterX = -parameters.hdCamera.taaJitter.x;
532535
dlssViewData.jitterY = -parameters.hdCamera.taaJitter.y;
533536
dlssViewData.reset = parameters.resetHistory;

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/FSR2Pass.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,10 @@ private void InternalAMDRender(
428428
bool useCameraCustomAttributes = parameters.hdCamera.fidelityFX2SuperResolutionUseCustomAttributes;
429429
var fsr2ViewData = new Fsr2ViewData();
430430
fsr2ViewData.inputRes = new UpscalerResolution() { width = (uint)parameters.hdCamera.actualWidth, height = (uint)parameters.hdCamera.actualHeight };
431-
fsr2ViewData.outputRes = new UpscalerResolution() { width = (uint)DynamicResolutionHandler.instance.finalViewport.x, height = (uint)DynamicResolutionHandler.instance.finalViewport.y };
431+
fsr2ViewData.outputRes = new UpscalerResolution() {
432+
width = (uint)parameters.hdCamera.finalViewport.width,
433+
height = (uint)parameters.hdCamera.finalViewport.height
434+
};
432435
fsr2ViewData.jitterX = parameters.hdCamera.taaJitter.x;
433436
fsr2ViewData.jitterY = parameters.hdCamera.taaJitter.y;
434437
fsr2ViewData.reset = parameters.hdCamera.isFirstFrame;

Packages/com.unity.render-pipelines.universal/Runtime/2D/Renderer2D.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ private RenderPassInputSummary GetRenderPassInputs(UniversalCameraData cameraDat
193193
|| cameraData.cameraTargetDescriptor.msaaSamples > 1 && UniversalRenderer.PlatformRequiresExplicitMsaaResolve()
194194
|| m_Renderer2DData.useCameraSortingLayerTexture
195195
|| !Mathf.Approximately(cameraData.renderScale, 1.0f)
196-
|| (DebugHandler != null && DebugHandler.WriteToDebugScreenTexture(cameraData.resolveFinalTarget));
196+
|| (DebugHandler != null && DebugHandler.WriteToDebugScreenTexture(cameraData.resolveFinalTarget))
197+
|| cameraData.captureActions != null;
197198

198199
return inputSummary;
199200
}

Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,18 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData
108108
// Early out for preview camera
109109
if (cameraData.cameraType == CameraType.Preview)
110110
isLitView = false;
111+
112+
DebugHandler debugHandler = GetActiveDebugHandler(cameraData);
113+
if (debugHandler != null)
114+
isLitView = debugHandler.IsLightingActive;
111115
#endif
112116

113117
// Preset global light textures for first batch
114118
if (batchIndex == 0)
115119
{
116120
using (var builder = graph.AddRasterRenderPass<SetGlobalPassData>(k_SetLightBlendTexture, out var passData, m_SetLightBlendTextureProfilingSampler))
117121
{
118-
if (layerBatch.lightStats.useLights)
122+
if (layerBatch.lightStats.useLights && isLitView)
119123
{
120124
passData.lightTextures = universal2DResourceData.lightTextures[batchIndex];
121125
for (var i = 0; i < passData.lightTextures.Length; i++)
@@ -167,7 +171,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData
167171
builder.UseRendererList(passData.rendererList);
168172
}
169173

170-
if (passData.layerUseLights)
174+
if (passData.layerUseLights && isLitView)
171175
{
172176
passData.lightTextures = universal2DResourceData.lightTextures[batchIndex];
173177
for (var i = 0; i < passData.lightTextures.Length; i++)

Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/Renderer2DRendergraph.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ internal sealed partial class Renderer2D : ScriptableRenderer
2525
DrawLight2DPass m_LightPass = new DrawLight2DPass();
2626
DrawShadow2DPass m_ShadowPass = new DrawShadow2DPass();
2727
DrawRenderer2DPass m_RendererPass = new DrawRenderer2DPass();
28+
CapturePass m_CapturePass = new CapturePass(RenderPassEvent.AfterRendering);
2829

2930
LayerBatch[] m_LayerBatches;
3031
int m_BatchCount;
@@ -792,6 +793,12 @@ private void OnAfterRendering(RenderGraph renderGraph)
792793
var finalBlitTarget = resolveToDebugScreen ? commonResourceData.debugScreenColor : commonResourceData.backBufferColor;
793794
var finalDepthHandle = resolveToDebugScreen ? commonResourceData.debugScreenDepth : commonResourceData.backBufferDepth;
794795

796+
// Capture pass for Unity Recorder
797+
if (hasCaptureActions)
798+
{
799+
m_CapturePass.RecordRenderGraph(renderGraph, frameData);
800+
}
801+
795802
if (applyFinalPostProcessing)
796803
{
797804
postProcessPass.RenderFinalPassRenderGraph(renderGraph, frameData, in finalColorHandle, commonResourceData.overlayUITexture, in finalBlitTarget, needsColorEncoding);

Packages/com.unity.render-pipelines.universal/Shaders/Utils/CopyDepthPass.hlsl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@
1717
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
1818
#define DEPTH_TEXTURE_MS(name, samples) Texture2DMSArray<float, samples> name
1919
#define DEPTH_TEXTURE(name) TEXTURE2D_ARRAY_FLOAT(name)
20-
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_ARRAY_MSAA(_CameraDepthAttachment, uv, unity_StereoEyeIndex, sampleIndex)
21-
#define SAMPLE(uv) SAMPLE_TEXTURE2D_ARRAY(_CameraDepthAttachment, sampler_CameraDepthAttachment, uv, unity_StereoEyeIndex).r
20+
#define LOAD_MSAA(coord, sampleIndex) LOAD_TEXTURE2D_ARRAY_MSAA(_CameraDepthAttachment, coord, unity_StereoEyeIndex, sampleIndex)
21+
#define LOAD(coord) LOAD_TEXTURE2D_ARRAY(_CameraDepthAttachment, coord, unity_StereoEyeIndex)
2222
#else
2323
#define DEPTH_TEXTURE_MS(name, samples) Texture2DMS<float, samples> name
2424
#define DEPTH_TEXTURE(name) TEXTURE2D_FLOAT(name)
25-
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_MSAA(_CameraDepthAttachment, uv, sampleIndex)
26-
#define SAMPLE(uv) SAMPLE_DEPTH_TEXTURE(_CameraDepthAttachment, sampler_CameraDepthAttachment, uv)
25+
#define LOAD_MSAA(coord, sampleIndex) LOAD_TEXTURE2D_MSAA(_CameraDepthAttachment, coord, sampleIndex)
26+
#define LOAD(coord) LOAD_TEXTURE2D(_CameraDepthAttachment, coord)
2727
#endif
2828

2929
#if MSAA_SAMPLES == 1
3030
DEPTH_TEXTURE(_CameraDepthAttachment);
31-
SAMPLER(sampler_CameraDepthAttachment);
3231
#else
3332
DEPTH_TEXTURE_MS(_CameraDepthAttachment, MSAA_SAMPLES);
34-
float4 _CameraDepthAttachment_TexelSize;
3533
#endif
3634

3735
#if UNITY_REVERSED_Z
@@ -42,17 +40,17 @@
4240
#define DEPTH_OP max
4341
#endif
4442

45-
float SampleDepth(float2 uv)
43+
float SampleDepth(float2 pixelCoords)
4644
{
45+
int2 coord = int2(pixelCoords);
4746
#if MSAA_SAMPLES == 1
48-
return SAMPLE(uv);
47+
return LOAD(coord).r;
4948
#else
50-
int2 coord = int2(uv * _CameraDepthAttachment_TexelSize.zw);
5149
float outDepth = DEPTH_DEFAULT_VALUE;
5250

5351
UNITY_UNROLL
5452
for (int i = 0; i < MSAA_SAMPLES; ++i)
55-
outDepth = DEPTH_OP(LOAD(coord, i), outDepth);
53+
outDepth = DEPTH_OP(LOAD_MSAA(coord, i), outDepth);
5654
return outDepth;
5755
#endif
5856
}
@@ -64,7 +62,7 @@ float frag(Varyings input) : SV_Target
6462
#endif
6563
{
6664
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
67-
return SampleDepth(input.texcoord);
65+
return SampleDepth(input.positionCS.xy);
6866
}
6967

7068
#endif

Packages/com.unity.shadergraph/Documentation~/Colorspace-Conversion-Node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Returns the result of converting the value of input **In** from one colorspace s
1616
| Name | Type | Options | Description |
1717
|:------------ |:-------------|:-----|:---|
1818
| From | Dropdown | RGB, Linear, HSV | Selects the colorspace to convert from |
19-
| To | Dropdown | RGB, Linear, HSV | Selects the colorspace to convert to |
19+
| To | Dropdown | RGB, Linear, HSV | Selects the colorspace to convert to. Returns values in the range 0 to 1, or higher if the color space is HDR. |
2020

2121
## Generated Code Example
2222

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
1-
# HD Scene Color Node
1+
# HD Scene Color node
22

3-
The HD Scene Color Node does the same thing as the Scene Color Node, but allows you to access the mips of the color buffer.
3+
The HD Scene Color node samples the color buffer of the current camera, using the screen space coordinates you input. The node works the same way as the [Scene Color Node](Scene-Color-Node.md) but returns the mipmap levels of the color buffer.
44

5-
## Render pipeline compatibility
5+
To make sure the HD Scene Color node outputs the correct values, follow these steps:
66

7-
| **Node** | **Universal Render Pipeline (URP)** | **High Definition Render Pipeline (HDRP)** |
8-
| -------------- | ----------------------------------- | ------------------------------------------ |
9-
| HD Scene Color | No | Yes |
7+
1. Connect the node to the fragment [shader stage](Shader-Stage.md). The HD Scene Color node doesn't support the vertex shader stage.
8+
2. In the **Graph Settings** tab of the [**Graph Inspector**](Internal-inspector.md) window, set **Surface Type** to **Transparent**. Otherwise, the node samples the color buffer before Unity renders all the opaque contents in the scene.
9+
10+
The node uses trilinear clamp mode to sample the color buffer, so it smoothly interpolates between the mipmap levels.
11+
12+
## Render pipeline support
13+
14+
The HD Scene Color node supports the High Definition Render Pipeline (HDRP) only. If you use the node with an unsupported pipeline, it returns 0 (black).
15+
16+
If you use your own custom render pipeline, you must define the behavior of the node yourself. Otherwise, the node returns a value of 0 (black).
1017

1118
## Ports
1219

13-
| Name | Direction | Type | Binding | Description |
14-
|:------------ |:-------------|:-----|:---|:---|
15-
| **UV** | Input | Vector 4 | Screen Position | Sets the normalized screen coordinates to sample. |
16-
| **Lod** | Input | float | None | Sets the mip level that the sampler uses to sample the color buffer. |
17-
| **Output** | Output | Vector 3 | None | Output value |
20+
| Name | Direction | Type | Binding | Description |
21+
|:--|:--|:--|:--|:--|
22+
| **UV** | Input | Vector 4 | Screen position | The normalized screen space coordinates to sample from. |
23+
| **Lod** | Input | float | None | The mipmap level to sample. |
24+
| **Output** | Output | Vector 3 | None | The color value from the color buffer at the coordinates and mipmap level. |
25+
26+
## Properties
1827

19-
## Notes
20-
### Exposure
28+
| **Property** | **Description** |
29+
|-|-|
30+
| **Exposure** | Applies [exposure](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/Override-Exposure.html) to the camera color. This property is disabled by default to avoid double exposure. |
2131

22-
You can use the Exposure property to specify if you want to output the Camera color with exposure applied or not. By default, this property is disabled to avoid double exposure.
32+
## Additional resources
2333

24-
The sampler that this Node uses to sample the color buffer is in trilinear clamp mode. This allows the sampler to smoothly interpolate between the mip maps.
34+
- [Scene Color Node](Scene-Color-Node.md)
35+
- [Custom pass buffers and pyramids](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/Custom-Pass-buffers-pyramids.html)

Packages/com.unity.shadergraph/Documentation~/Property-Types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Defines a [Cubemap](https://docs.unity3d.com/Manual/class-Cubemap.html) value. D
152152
<a name="virtual-texture"> </a>
153153
## Virtual Texture
154154

155-
Defines a [Texture Stack](https://docs.unity3d.com/2020.1/Documentation/Manual/svt-use-in-shader-graph.html), which appears as object fields of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the Material Inspector. The number of fields correspond to the number of layers in the property.
155+
Defines a [Texture Stack](https://docs.unity3d.com/Manual/svt-use-in-shader-graph.html), which appears as object fields of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the Material Inspector. The number of fields corresponds to the number of layers in the property.
156156

157157
| Data Type | Modes |
158158
|:----------|-------|

Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Sample-Feature-Examples.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Feature Examples
1+
# Feature Examples sample
22

33
The Shader Graph Feature Examples sample content is a collection of Shader Graph assets that demonstrate how to achieve common techniques and effects in Shader Graph. The goal of this sample pack is to help users see what is required to achieve specific effects and provide examples to make it easier for users to learn.
44

5+
Each sample contains notes that describe what the shader does. Most of the shaders have their core functionality in a subgraph, so you can copy and paste them into your own shader graphs.
6+
57
The sample content is broken into the following categories:
68

79
- **Blending Masks** - these samples generate masks based on characteristics of the surface - such as height, facing angle, or distance from the camera.

0 commit comments

Comments
 (0)