diff --git a/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs index da84c8468c9..82e02151b1d 100644 --- a/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs +++ b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs @@ -12,6 +12,7 @@ public class RenderGraphDefaultResources // We need to keep around a RTHandle version of default regular 2D textures since RenderGraph API is all RTHandle. RTHandle m_BlackTexture2D; RTHandle m_WhiteTexture2D; + RTHandle m_ShadowTexture2D; /// Default black 2D texture. public TextureHandle blackTexture { get; private set; } @@ -31,23 +32,28 @@ public class RenderGraphDefaultResources public TextureHandle blackTexture3DXR { get; private set; } /// Default white XR 2D texture. public TextureHandle whiteTextureXR { get; private set; } + /// Default 1x1 shadow texture. + public TextureHandle defaultShadowTexture { get; private set; } internal RenderGraphDefaultResources() { m_BlackTexture2D = RTHandles.Alloc(Texture2D.blackTexture); m_WhiteTexture2D = RTHandles.Alloc(Texture2D.whiteTexture); + m_ShadowTexture2D = RTHandles.Alloc(1, 1, depthBufferBits: DepthBits.Depth32, isShadowMap: true); } internal void Cleanup() { m_BlackTexture2D.Release(); m_WhiteTexture2D.Release(); + m_ShadowTexture2D.Release(); } internal void InitializeForRendering(RenderGraph renderGraph) { blackTexture = renderGraph.ImportTexture(m_BlackTexture2D); whiteTexture = renderGraph.ImportTexture(m_WhiteTexture2D); + defaultShadowTexture = renderGraph.ImportTexture(m_ShadowTexture2D); clearTextureXR = renderGraph.ImportTexture(TextureXR.GetClearTexture()); magentaTextureXR = renderGraph.ImportTexture(TextureXR.GetMagentaTexture()); diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 60016f02c48..dd32fa839c2 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -33,6 +33,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed depth pyramid being incorrect when having multiple cameras (scene view and gameview) and when hardware DRS was activated. - Fixed the cloudlayer not using depth buffer. - Fixed crossfade not working on the HD ST8 ShaderGraph [case 1369586](https://fogbugz.unity3d.com/f/cases/1369586/) +- Fixed range compression factor being clamped. (case 1365707) +- Fixed tooltip not showing on labels in ShaderGraphs (1358483). +- Fix API warnings in Matcap mode on Metal. +- Fix D3D validation layer errors w.r.t shadow textures when an atlas is not used. ## [13.0.0] - 2021-09-01 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Feature-Comparison.md b/com.unity.render-pipelines.high-definition/Documentation~/Feature-Comparison.md index 37f802adbce..3ab6eee725c 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Feature-Comparison.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Feature-Comparison.md @@ -116,6 +116,7 @@ The tables that follow provide an overview of the Features that the High Definit | **Realtime** | Yes | yes | | **Baked** | Yes | Yes | | ***Sampling*** | | | +| **Anchor Override** | Yes | Not supported | | **Simple** | Yes | See [Reflection Hierarchy](Reflection-in-HDRP.md). | | **Blend Probes** | Yes | See [Reflection Hierarchy](Reflection-in-HDRP.md). | | **Blend Probes and Skybox** | Yes | See [Reflection Hierarchy](Reflection-in-HDRP.md). | diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs index e421af53911..5091116c7de 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs @@ -39,9 +39,6 @@ internal override void Update() internal override void Apply() { - // Force the mode to real time so its influence is properly culled by the camera. - legacyMode.intValue = 1; - serializedLegacyObject.ApplyModifiedProperties(); base.Apply(); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SubTargetPropertyBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SubTargetPropertyBlock.cs index 105348408cc..7f8f51fc16e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SubTargetPropertyBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SubTargetPropertyBlock.cs @@ -45,16 +45,16 @@ protected void AddProperty(GUIContent displayName, Func getter, Acti switch (getter()) { - case bool b: elem = new Toggle { value = b, tooltip = displayName.tooltip } as BaseField; break; - case int i: elem = new IntegerField { value = i, tooltip = displayName.tooltip, isDelayed = true } as BaseField; break; - case float f: elem = new FloatField { value = f, tooltip = displayName.tooltip, isDelayed = true } as BaseField; break; - case Enum e: elemEnum = new EnumField(e) { value = e, tooltip = displayName.tooltip }; break; + case bool b: elem = new Toggle { value = b } as BaseField; break; + case int i: elem = new IntegerField { value = i, isDelayed = true } as BaseField; break; + case float f: elem = new FloatField { value = f, isDelayed = true } as BaseField; break; + case Enum e: elemEnum = new EnumField(e) { value = e }; break; default: throw new Exception($"Can't create UI field for type {getter().GetType()}, please add it if it's relevant. If you can't consider using TargetPropertyGUIContext.AddProperty instead."); } if (elem != null) { - context.AddProperty(displayName.text, indentLevel, elem, (evt) => + context.AddProperty(displayName.text, displayName.tooltip, indentLevel, elem, (evt) => { if (Equals(getter(), evt.newValue)) return; @@ -66,7 +66,7 @@ protected void AddProperty(GUIContent displayName, Func getter, Acti } else { - context.AddProperty(displayName.text, indentLevel, elemEnum, (evt) => + context.AddProperty(displayName.text, displayName.tooltip, indentLevel, elemEnum, (evt) => { if (Equals(getter(), evt.newValue)) return; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl index f5e0988fc13..2ede51557b7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl @@ -153,15 +153,18 @@ float4 SampleEnv(LightLoopContext lightLoopContext, int index, float3 texCoord, color.rgb = SAMPLE_TEXTURECUBE_ARRAY_LOD_ABSTRACT(_EnvCubemapTextures, s_trilinear_clamp_sampler, texCoord, _EnvSliceSize * index + sliceIdx, lod).rgb; } + // Planar and Reflection Probes aren't pre-expose, so best to clamp to max16 here in case of inf + color.rgb = ClampToFloat16Max(color.rgb); + color.rgb *= rangeCompressionFactorCompensation; } else // SINGLE_PASS_SAMPLE_SKY { color.rgb = SampleSkyTexture(texCoord, lod, sliceIdx).rgb; + // Sky isn't pre-expose, so best to clamp to max16 here in case of inf + color.rgb = ClampToFloat16Max(color.rgb); } - // Planar, Reflection Probes and Sky aren't pre-expose, so best to clamp to max16 here in case of inf - color.rgb = ClampToFloat16Max(color.rgb); return color; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute index 9ee41237afd..a0c661787da 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute @@ -2,12 +2,12 @@ #pragma kernel GTAODenoise_CopyHistory -RW_TEXTURE2D_X(uint, _OutputTexture); +RW_TEXTURE2D_X(float4, _OutputTexture); TEXTURE2D_X(_InputTexture); [numthreads(8, 8, 1)] void GTAODenoise_CopyHistory(uint3 dispatchThreadId : SV_DispatchThreadID) { UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z); - _OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = _InputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)].x; + _OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = _InputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)]; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs index c45f4e0bf0c..fcddfe28a23 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs @@ -537,7 +537,7 @@ internal TextureHandle RenderShadows(RenderGraph renderGraph, CullingResults cul { if (m_ShadowRequests.Count == 0) { - return renderGraph.defaultResources.blackTexture; + return renderGraph.defaultResources.defaultShadowTexture; } TextureHandle atlas = RenderShadowMaps(renderGraph, cullResults, globalCB, frameSettings, shadowPassName); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs index 71c1fae1b85..438b8019789 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs @@ -949,7 +949,7 @@ static void BindAtlasTexture(RenderGraphContext ctx, TextureHandle texture, int if (texture.IsValid()) ctx.cmd.SetGlobalTexture(shaderId, texture); else - ctx.cmd.SetGlobalTexture(shaderId, ctx.defaultResources.blackTexture); + ctx.cmd.SetGlobalTexture(shaderId, ctx.defaultResources.defaultShadowTexture); } void BindShadowGlobalResources(RenderGraph renderGraph, in ShadowResult shadowResult) @@ -970,6 +970,23 @@ void BindShadowGlobalResources(RenderGraph renderGraph, in ShadowResult shadowRe } } + internal static void BindDefaultShadowGlobalResources(RenderGraph renderGraph) + { + using (var builder = renderGraph.AddRenderPass("BindDefaultShadowGlobalResources", out var passData)) + { + builder.AllowPassCulling(false); + builder.SetRenderFunc( + (BindShadowGlobalResourcesPassData data, RenderGraphContext ctx) => + { + BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapAtlas); + BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapCascadeAtlas); + BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapAreaAtlas); + BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._CachedShadowmapAtlas); + BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._CachedAreaLightShadowmapAtlas); + }); + } + } + void BlitCachedShadows(RenderGraph renderGraph) { m_Atlas.BlitCachedIntoAtlas(renderGraph, cachedShadowManager.punctualShadowAtlas, m_BlitShadowMaterial, "Blit Punctual Mixed Cached Shadows", HDProfileId.BlitPunctualMixedCachedShadowMaps); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs index 06086615fc5..e016be9dabc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs @@ -1138,6 +1138,8 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu HDUtils.BlitColorAndDepth(context.cmd, data.clearColorTexture, data.clearDepthTexture, new Vector4(1, 1, 0, 0), 0, !data.clearDepth); } + BindDefaultTexturesLightingBuffers(context.defaultResources, context.cmd); + BindDBufferGlobalData(data.dbuffer, context); DrawOpaqueRendererList(context, data.frameSettings, data.opaqueRendererList); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index cc4e463ca3e..ea69c2562f5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -40,6 +40,15 @@ static void BindGlobalLightingBuffers(in LightingBuffers buffers, CommandBuffer cmd.SetGlobalTexture(HDShaderIDs._ScreenSpaceShadowsTexture, buffers.screenspaceShadowBuffer); } + static void BindDefaultTexturesLightingBuffers(RenderGraphDefaultResources defaultResources, CommandBuffer cmd) + { + cmd.SetGlobalTexture(HDShaderIDs._AmbientOcclusionTexture, defaultResources.blackTextureXR); + cmd.SetGlobalTexture(HDShaderIDs._SsrLightingTexture, defaultResources.blackTextureXR); + cmd.SetGlobalTexture(HDShaderIDs._IndirectDiffuseTexture, defaultResources.blackTextureXR); + cmd.SetGlobalTexture(HDShaderIDs._ContactShadowTexture, defaultResources.blackUIntTextureXR); + cmd.SetGlobalTexture(HDShaderIDs._ScreenSpaceShadowsTexture, defaultResources.blackTextureXR); + } + class BuildGPULightListPassData { // Common diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 4decba13e1d..56cf3a3adb5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -109,6 +109,8 @@ void RecordRenderGraph(RenderRequest renderRequest, // For alpha output in AOVs or debug views, in case we have a shadow matte material, we need to render the shadow maps if (m_CurrentDebugDisplaySettings.data.materialDebugSettings.debugViewMaterialCommonValue == Attributes.MaterialSharedProperty.Alpha) RenderShadows(m_RenderGraph, hdCamera, cullingResults, ref shadowResult); + else + HDShadowManager.BindDefaultShadowGlobalResources(m_RenderGraph); // Stop Single Pass is after post process. StartXRSinglePass(m_RenderGraph, hdCamera);