diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 0c689367d4f..b85e09bebf8 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue with transparent meshes writing their depths and recursive rendering (case 1314409). - Fixed issue with compositor custom pass hooks added/removed repeatedly (case 1315971). - Fixed: SSR with transparent (case 1311088) +- Fixed decals in material debug display. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/DecalSurfaceInputsUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/DecalSurfaceInputsUIBlock.cs index e30aaa8ae68..364e39e1510 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/DecalSurfaceInputsUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/DecalSurfaceInputsUIBlock.cs @@ -246,7 +246,7 @@ void DrawDecalGUI() materialEditor.ShaderProperty(smoothness, Styles.smoothnessText); } - PopupShaderProperty(maskBlendSrc, Styles.normalOpacityChannelText, allMaskMap ? blendSourceNames : blendSourceNamesNoMap); + PopupShaderProperty(maskBlendSrc, Styles.maskOpacityChannelText, allMaskMap ? blendSourceNames : blendSourceNamesNoMap); EditorGUI.indentLevel--; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalData.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalData.hlsl index 4c3bd1d4f3f..34dfab7ef89 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalData.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalData.hlsl @@ -24,7 +24,7 @@ void GetSurfaceData(FragInputs input, float3 V, PositionInputs posInput, float a #endif float albedoMapBlend = fadeFactor; - float maskMapBlend = fadeFactor; + float maskMapBlend = _DecalMaskMapBlueScale * fadeFactor; ZERO_INITIALIZE(DecalSurfaceData, surfaceData); @@ -57,7 +57,6 @@ void GetSurfaceData(FragInputs input, float3 V, PositionInputs posInput, float a #ifdef _MATERIAL_AFFECTS_MASKMAP #ifdef _MASKMAP surfaceData.mask = SAMPLE_TEXTURE2D(_MaskMap, sampler_MaskMap, texCoords); - surfaceData.mask.z *= _DecalMaskMapBlueScale; maskMapBlend *= surfaceData.mask.z; // store before overwriting with smoothness #ifdef DECALS_4RT surfaceData.mask.x = lerp(_MetallicRemapMin, _MetallicRemapMax, surfaceData.mask.x); @@ -65,8 +64,6 @@ void GetSurfaceData(FragInputs input, float3 V, PositionInputs posInput, float a #endif surfaceData.mask.z = lerp(_SmoothnessRemapMin, _SmoothnessRemapMax, surfaceData.mask.w); #else - surfaceData.mask.z = _DecalMaskMapBlueScale; - maskMapBlend *= surfaceData.mask.z; // store before overwriting with smoothness #ifdef DECALS_4RT surfaceData.mask.x = _Metallic; surfaceData.mask.y = _AO; 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 8c917eb33b4..898a067f3d3 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 @@ -1012,12 +1012,16 @@ class DebugViewMaterialData public Material debugGBufferMaterial; public FrameSettings frameSettings; + public bool decalsEnabled; + public ComputeBufferHandle perVoxelOffset; + public DBufferOutput dbuffer; + public Texture clearColorTexture; public RenderTexture clearDepthTexture; public bool clearDepth; } - TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cull, HDCamera hdCamera) + TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cull, HDCamera hdCamera, BuildGPULightListOutput lightLists, DBufferOutput dbuffer) { bool msaa = hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA); @@ -1066,6 +1070,10 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu rendererConfiguration: m_CurrentRendererConfigurationBakedLighting, stateBlock: m_DepthStateNoWrite))); + passData.decalsEnabled = (hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals)) && (DecalSystem.m_DecalDatasCount > 0); + passData.perVoxelOffset = builder.ReadComputeBuffer(lightLists.perVoxelOffset); + passData.dbuffer = ReadDBuffer(dbuffer, builder); + passData.clearColorTexture = Compositor.CompositionManager.GetClearTextureForStackedCamera(hdCamera); // returns null if is not a stacked camera passData.clearDepthTexture = Compositor.CompositionManager.GetClearDepthForStackedCamera(hdCamera); // returns null if is not a stacked camera passData.clearDepth = hdCamera.clearDepth; @@ -1080,7 +1088,14 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu { HDUtils.BlitColorAndDepth(context.cmd, data.clearColorTexture, data.clearDepthTexture, new Vector4(1, 1, 0, 0), 0, !data.clearDepth); } + + BindDBufferGlobalData(data.dbuffer, context); DrawOpaqueRendererList(context, data.frameSettings, data.opaqueRendererList); + + if (data.decalsEnabled) + DecalSystem.instance.SetAtlas(context.cmd); // for clustered decals + if (data.perVoxelOffset.IsValid()) + context.cmd.SetGlobalBuffer(HDShaderIDs.g_vLayeredOffsetsBuffer, data.perVoxelOffset); DrawTransparentRendererList(context, data.frameSettings, data.transparentRendererList); }); } 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 3988cd3bb33..2946507cc6a 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 @@ -97,6 +97,8 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest, } else if (m_CurrentDebugDisplaySettings.IsDebugMaterialDisplayEnabled() || m_CurrentDebugDisplaySettings.IsMaterialValidationEnabled() || CoreUtils.IsSceneLightingDisabled(hdCamera.camera)) { + gpuLightListOutput = BuildGPULightList(m_RenderGraph, hdCamera, m_TileAndClusterData, m_TotalLightCount, ref m_ShaderVariablesLightListCB, prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.gbuffer); + // 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); @@ -104,7 +106,7 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest, // Stop Single Pass is after post process. StartXRSinglePass(m_RenderGraph, hdCamera); - colorBuffer = RenderDebugViewMaterial(m_RenderGraph, cullingResults, hdCamera); + colorBuffer = RenderDebugViewMaterial(m_RenderGraph, cullingResults, hdCamera, gpuLightListOutput, prepassOutput.dbuffer); colorBuffer = ResolveMSAAColor(m_RenderGraph, hdCamera, colorBuffer); } else if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) &&