Skip to content

Commit a91b63e

Browse files
authored
Merge pull request #8268 from Unity-Technologies/internal/6000.4/staging
Mirror Internal/6000.4/staging
2 parents 062bce0 + 7f779bc commit a91b63e

File tree

124 files changed

+512
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+512
-1370
lines changed

Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/SurfaceCacheWorld.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public AccelStructAdapter GetAccelerationStructure()
149149

150150
public void RemoveInstance(InstanceHandle instance)
151151
{
152-
_rayTracingAccelerationStructure.RemoveInstance(instance.ToInt());
152+
_rayTracingAccelerationStructure.RemoveInstance(instance.Value);
153153
_instanceHandleSet.Remove(instance);
154154
}
155155

@@ -193,18 +193,18 @@ public InstanceHandle AddInstance(
193193
}
194194

195195
InstanceHandle instance = _instanceHandleSet.Add();
196-
_rayTracingAccelerationStructure.AddInstance(instance.ToInt(), mesh, localToWorldMatrix, masks, materialIndices, isOpaque, 0);
196+
_rayTracingAccelerationStructure.AddInstance(instance.Value, mesh, localToWorldMatrix, masks, materialIndices, isOpaque, 0);
197197
return instance;
198198
}
199199

200200
public void UpdateInstanceTransform(InstanceHandle instance, Matrix4x4 localToWorldMatrix)
201201
{
202-
_rayTracingAccelerationStructure.UpdateInstanceTransform(instance.ToInt(), localToWorldMatrix);
202+
_rayTracingAccelerationStructure.UpdateInstanceTransform(instance.Value, localToWorldMatrix);
203203
}
204204

205205
public void UpdateInstanceMask(InstanceHandle instance, Span<uint> perSubMeshMask)
206206
{
207-
_rayTracingAccelerationStructure.UpdateInstanceMask(instance.ToInt(), perSubMeshMask);
207+
_rayTracingAccelerationStructure.UpdateInstanceMask(instance.Value, perSubMeshMask);
208208
}
209209

210210
public void UpdateInstanceMaterials(InstanceHandle instance, Span<MaterialHandle> materials)
@@ -215,7 +215,7 @@ public void UpdateInstanceMaterials(InstanceHandle instance, Span<MaterialHandle
215215
_materialPool.GetMaterialInfo(materials[i].Value, out materialIndices[i], out bool isTransmissive);
216216
}
217217

218-
_rayTracingAccelerationStructure.UpdateInstanceMaterialIDs(instance.ToInt(), materialIndices);
218+
_rayTracingAccelerationStructure.UpdateInstanceMaterialIDs(instance.Value, materialIndices);
219219
}
220220

221221
public LightHandle[] AddLights(Span<LightDescriptor> lightDescs)

Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ struct UnityTexture3D
155155
TEXTURE3D(tex);
156156
SAMPLER(samplerstate);
157157

158+
// This dummy field is unused in Unity 6.4 and earlier. Here, the field is added strictly as a dummy to work around UUM-133088
159+
// Without this additional field, UnityTexture3D and sampler3D_f have the exact same structure, which will cause DXC to consider
160+
// them as the same type. This causes to compilation errors due to the corresponding overloads of tex3D being considered ambiguous
161+
// by DXC. Adding the field resolves this. Starting from Unity 6.5, the field is actually used in code.
162+
float4 hdrDecode;
163+
158164
// these functions allows users to convert code using Texture3D to UnityTexture3D by simply changing the type of the variable
159165
// the existing texture macros will call these functions, which will forward the call to the texture appropriately
160166
float4 Sample(UnitySamplerState s, float3 uvw) { return SAMPLE_TEXTURE3D(tex, s.samplerstate, uvw); }

Packages/com.unity.render-pipelines.high-definition/Documentation~/deep-learning-super-sampling-in-hdrp.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deep learning super sampling (DLSS)
22

3-
[NVIDIA Deep Learning Super Sampling (DLSS)](https://www.nvidia.com/en-us/geforce/technologies/dlss/) is a rendering technology that uses artificial intelligence to increase graphics performance. The High Definition Render Pipeline (HDRP) natively supports DLSS 4 Super Resolution.
3+
[NVIDIA Deep Learning Super Sampling (DLSS)](https://www.nvidia.com/en-us/geforce/technologies/dlss/) is a rendering technology that uses artificial intelligence to increase graphics performance. The High Definition Render Pipeline (HDRP) natively supports DLSS 4.5 Super Resolution.
44

55
## Requirements and compatibility
66

@@ -82,18 +82,20 @@ Available presets are marked as '1' in the table below.
8282

8383
| Render Preset | Maximum Quality | Balanced | Maximum Performance | Ultra Performance | DLAA | Explanation | AI Model |
8484
|- |- |- |- |- |- |- |- |
85-
| Preset F | | | | 1 | 1 | Provides the highest image stability. Default value for UltraPerformance. | CNN |
86-
| Preset J | 1 | 1 | 1| | 1 | Slightly lowers ghosting but increases flickering.<br/>NVIDIA recommends using **Preset K** instead of **Preset J**. | Transformer |
87-
| Preset K | 1 | 1 | 1| | 1 | Provides the highest image quality. | Transformer |
85+
| Preset F | | | | 1 | 1 | Marked for deprecation in upcoming DLSS releases. Don't use for new projects. | CNN |
86+
| Preset J | 1 | 1 | 1| 1 | 1 | Slightly lowers ghosting but increases flickering.<br/>NVIDIA recommends using **Preset K** instead of **Preset J**. | Transformer |
87+
| Preset K | 1 | 1 | 1| 1 | 1 | Default preset for DLAA/Balanced/Quality modes. Requires fewer resources than Preset L. | Transformer |
88+
| Preset L | | | | 1 | | Delivers a sharper, more stable image with less ghosting than Preset J, K, but lowers performance. Recommended for RTX 40 Series GPUs and above. | Transformer Gen 2 |
89+
Provides about the same image quality as **Preset L**. This preset is slower than presets **J** and **K**, but faster than preset **L**. Recommended for RTX 40 Series GPUs and above.
8890

8991
The defaults for each quality mode are:
9092

9193
| **Quality mode** | **Default render preset** |
9294
|- |- |
93-
| **Maximum Quality** | Preset K
94-
| **Balanced** | Preset K
95-
| **Maximum Performance** | Preset K
96-
| **Ultra Performance** | Preset F
95+
| **Maximum Quality** | Preset K |
96+
| **Balanced** | Preset K |
97+
| **Maximum Performance** | Preset M |
98+
| **Ultra Performance** | Preset L |
9799
| **DLAA** | Preset K |
98100

99101
DLSS render presets are project-specific. Presets are available only from the HDRP Asset settings. You can't override presets on a per-camera basis.

Packages/com.unity.render-pipelines.high-definition/Documentation~/getting-started-in-hdrp.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ Set up a project to use the High Definition Render Pipeline (HDRP), and use Volu
1010
## Additional resources
1111

1212
- [HDRP overview](HDRP-Features.md)
13-
- [Achieving High Fidelity Graphics for Games with HDRP](https://resources.unity.com/unitenow/onlinesessions/achieving-high-fidelity-graphics-for-games-with-hdrp)

Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ int CountBits(uint bitMask) // System.Numerics.BitOperations not available
319319
{
320320
if (preset == UnityEngine.NVIDIA.DLSSPreset.Preset_Default)
321321
{
322-
labels[(int)quality][iWrite++] = "Default Preset";
322+
labels[(int)quality][iWrite++] = "Default Preset" + " - " + UnityEngine.NVIDIA.GraphicsDevice.GetDLSSPresetExplanation(preset);
323323
continue;
324324
}
325325

Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,41 @@ void REPROJECT_CLOUDS(uint3 dispatchThreadId : SV_DispatchThreadID,
9696
float validityFactor = 1.0;
9797

9898
#ifdef WITH_REJECTION
99+
100+
bool currentIsSky = currentSceneDepth == UNITY_RAW_FAR_CLIP_VALUE;
101+
99102
float4 lightingMin = float4(FLT_MAX, FLT_MAX, FLT_MAX, 1.0);
100103
float4 lightingMax = float4(0, 0, 0, 0.0);
101-
for (int y = -1; y <= 1; ++y)
104+
105+
int skySampleCount = 0;
106+
if(currentIsSky)
102107
{
103-
for (int x = -1; x <= 1; ++x)
108+
for (int y = -1; y <= 1; ++y)
104109
{
105-
CloudReprojectionData data = GetCloudReprojectionDataSample(threadCoord, int2(x, y));
106-
if ((data.pixelDepth == UNITY_RAW_FAR_CLIP_VALUE) == (currentSceneDepth == UNITY_RAW_FAR_CLIP_VALUE))
110+
for (int x = -1; x <= 1; ++x)
107111
{
108-
lightingMin = min(lightingMin, data.cloudLighting);
109-
lightingMax = max(lightingMax, data.cloudLighting);
112+
CloudReprojectionData data = GetCloudReprojectionDataSample(threadCoord, int2(x, y));
113+
bool sampleIsSky = data.pixelDepth == UNITY_RAW_FAR_CLIP_VALUE;
114+
115+
if (sampleIsSky)
116+
{
117+
lightingMin = min(lightingMin, data.cloudLighting);
118+
lightingMax = max(lightingMax, data.cloudLighting);
119+
skySampleCount++;
120+
}
110121
}
111122
}
123+
124+
// Only apply clamping if we have enough sky samples (at least 5 out of 9)
125+
if (skySampleCount >= 5)
126+
{
127+
// Modulate validity factor based on sky sample ratio, the more samples are sky, the more ghosting reduction
128+
float skyRatio = skySampleCount / 9.0;
129+
previousColor = ClipCloudsToRegion(previousColor, lightingMin, lightingMax, skyRatio);
130+
validityFactor *= skyRatio;
131+
}
112132
}
113133

114-
previousColor = ClipCloudsToRegion(previousColor, lightingMin, lightingMax, validityFactor);
115134
#endif
116135

117136
if (validTracing)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private bool ShouldUseAutomaticSettings()
183183

184184
static NVIDIA.DLSSPreset Uint2Preset(uint preset)
185185
{
186-
if (preset >= (uint)NVIDIA.DLSSPreset.Preset_Default && preset <= (uint)NVIDIA.DLSSPreset.Preset_K)
186+
if (preset >= (uint)NVIDIA.DLSSPreset.Preset_Default && preset <= (uint)NVIDIA.DLSSPreset.Preset_M)
187187
return (NVIDIA.DLSSPreset)preset;
188188
Debug.LogWarningFormat("Unknown DLSS Preset value {0}, using default value.", preset);
189189
return NVIDIA.DLSSPreset.Preset_Default;

Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs renamed to Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static bool IsSurfaceCacheEnabled(List<UniversalRenderPipelineAsset> urpAssets)
2121

2222
foreach (var rendererFeature in rendererData.rendererFeatures)
2323
{
24-
if (rendererFeature is SurfaceCacheGlobalIlluminationRendererFeature { isActive: true })
24+
if (rendererFeature is SurfaceCacheGIRendererFeature { isActive: true })
2525
return true;
2626
}
2727
}

Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGlobalIlluminationStripper.cs.meta renamed to Packages/com.unity.render-pipelines.universal/Editor/BuildProcessors/GraphicsSettingsStrippers/SurfaceCacheGIStripper.cs.meta

File renamed without changes.

Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGlobalIlluminationEditor.cs renamed to Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/SurfaceCacheGIEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
namespace UnityEditor.Rendering.Universal
88
{
9-
[CustomEditor(typeof(SurfaceCacheGlobalIlluminationRendererFeature))]
10-
internal class SurfaceCacheGlobalIlluminationEditor : Editor
9+
[CustomEditor(typeof(SurfaceCacheGIRendererFeature))]
10+
internal class SurfaceCacheGIEditor : Editor
1111
{
1212
private bool m_IsInitialized;
1313

0 commit comments

Comments
 (0)