diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 55481e24e24..2239f3f9b04 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -97,6 +97,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added support for alpha to coverage for HDRP shaders and shader graph - Added support for Quality Levels to Subsurface Scattering. - Added option to disable XR rendering on the camera settings. +- Added a frame setting for alpha to mask. ### Fixed - Fix when rescale probe all direction below zero (1219246) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md b/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md index 98d91498b87..8037715e3ac 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md @@ -28,6 +28,7 @@ These settings determine the method that the Cameras and Reflection Probes using | - **Depth Prepass within Deferred** | If you enable Decals then HDRP forces a depth prepass and you can not disable this feature. This feature fills the depth buffer with all Meshes, without rendering any color. It is an optimization option that depends on the Unity Project you are creating, meaning that you should measure the performance before and after you enable this feature to make sure it benefits your Project. This is only available if you set **Lit Shader Mode** to **Deferred**. | | - **Clear GBuffers** | Enable the checkbox to make HDRP clear GBuffers for Cameras using these Frame Settings. This is only available if you set **Lit Shader Mode** to **Deferred**. | | - **MSAA within Forward** | Enable the checkbox to enable MSAA for the rendering components using these Frame Settings. This is only available if you set **Lit Shader Mode** to **Forward**. | +| - **Alpha To Mask** | Enable the checkbox to make HDRP render with **Alpha to Mask** Materials that have enabled it. This is only available if you enable **MSAA within Forward**.")] | **Opaque Objects** | Enable the checkbox to make HDRP render Materials that have their **Surface Type** set to **Opaque**. If you disable this settings, Cameras/Reflection Probes using these Frame Settings do not render any opaque GameObjects. | | **Transparent Objects** | Enable the checkbox to make HDRP render Materials that have their **Surface Type** set to **Transparent**. If you disable this setting, Cameras/Reflection Probes using these Frame Settings do not render any transparent GameObjects. | | **Decals** | Enable the checkbox to make HDRP process decals. Enable this on cameras that you want to render decals. | diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 8c08d67f32a..93397a85cdd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -3050,7 +3050,7 @@ DepthPrepassParameters PrepareDepthPrepass(CullingResults cull, HDCamera hdCamer result.profilingId = HDProfileId.DepthPrepassForward; RenderStateBlock? stateBlock = null; - if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA)) + if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.AlphaToMask)) stateBlock = m_AlphaToMaskBlock; result.mrtRendererListDesc = CreateOpaqueRendererListDesc( cull, hdCamera.camera, m_DepthOnlyAndDepthForwardOnlyPassNames, stateBlock: stateBlock, excludeObjectMotionVectors: objectMotionEnabled); @@ -3804,7 +3804,7 @@ void RenderObjectsMotionVectors(CullingResults cullResults, HDCamera hdCamera, S cmd.SetGlobalInt(HDShaderIDs._ColorMaskNormal, hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA) ? (int)ColorWriteMask.All : 0); RenderStateBlock? stateBlock = null; - if (hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred || !hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA)) + if (hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred || !hdCamera.frameSettings.IsEnabled(FrameSettingsField.AlphaToMask)) stateBlock = m_AlphaToMaskBlock; CoreUtils.SetRenderTarget(cmd, m_SharedRTManager.GetMotionVectorsPassBuffersRTI(hdCamera.frameSettings), m_SharedRTManager.GetDepthStencilBuffer(hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA))); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs index c4dfda02051..a2b55e98c4b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs @@ -102,6 +102,9 @@ public enum FrameSettingsField /// When enabled, Cameras using these Frame Settings calculate MSAA when they render the Scene. Set Lit Shader Mode to Forward to access this option. [FrameSettingsField(0, displayedName: "MSAA within Forward", negativeDependencies: new[] { LitShaderMode }, customOrderInGroup: 3, tooltip: "When enabled, Cameras using these Frame Settings calculate MSAA when they render the Scene. Set Lit Shader Mode to Forward to access this option.")] MSAA = 31, + /// When enabled, Cameras using these Frame Settings use Alpha To Mask. Activate MSAA to access this option. + [FrameSettingsField(0, displayedName: "Alpha To Mask", positiveDependencies: new[] { MSAA }, customOrderInGroup: 3, tooltip: "When enabled, Cameras using these Frame Settings use Alpha To Mask. Activate MSAA to access this option.")] + AlphaToMask = 56, /// When enabled, Cameras using these Frame Settings render opaque GameObjects. [FrameSettingsField(0, autoName: OpaqueObjects, customOrderInGroup: 4, tooltip: "When enabled, Cameras using these Frame Settings render opaque GameObjects.")] OpaqueObjects = 2, @@ -422,6 +425,7 @@ partial struct FrameSettings (uint)FrameSettingsField.SkyReflection, (uint)FrameSettingsField.DirectSpecularLighting, (uint)FrameSettingsField.RayTracing, + (uint)FrameSettingsField.AlphaToMask, (uint)FrameSettingsField.ProbeVolume, }), lodBias = 1, @@ -730,6 +734,7 @@ internal static void Sanitize(ref FrameSettings sanitizedFrameSettings, Camera c //MSAA only supported in forward // TODO: The work will be implemented piecemeal to support all passes bool msaa = sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.MSAA] &= renderPipelineSettings.supportMSAA && sanitizedFrameSettings.litShaderMode == LitShaderMode.Forward; + sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.AlphaToMask] &= msaa; // No recursive reflections sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.SSR] &= renderPipelineSettings.supportSSR && !msaa && !preview; diff --git a/com.unity.testing.hdrp/RP_Assets/HDRP_Test_Def_MSAAForward.asset b/com.unity.testing.hdrp/RP_Assets/HDRP_Test_Def_MSAAForward.asset index a436d397864..e8e68177f3d 100644 --- a/com.unity.testing.hdrp/RP_Assets/HDRP_Test_Def_MSAAForward.asset +++ b/com.unity.testing.hdrp/RP_Assets/HDRP_Test_Def_MSAAForward.asset @@ -12,7 +12,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0cf1dab834d4ec34195b920ea7bbf9ec, type: 3} m_Name: HDRP_Test_Def_MSAAForward m_EditorClassIdentifier: - m_Version: 7 + m_Version: 15 m_ObsoleteFrameSettings: overrides: 0 enableShadow: 0 @@ -153,44 +153,78 @@ MonoBehaviour: m_RenderPipelineRayTracingResources: {fileID: 0} m_DefaultVolumeProfile: {fileID: 11400000, guid: aea7ff43876258748be47d8751e0e9d5, type: 2} + m_DefaultLookDevProfile: {fileID: 11400000, guid: 254c4fe87beb7be4fa72e1681edbed02, + type: 2} m_RenderingPathDefaultCameraFrameSettings: bitDatas: - data1: 1288481013532 + data1: 72130075896840028 data2: 4539628424657829888 lodBias: 1 lodBiasMode: 0 + lodBiasQualityLevel: 0 maximumLODLevel: 0 maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 20 + materialQuality: 0 m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings: bitDatas: - data1: 1174664249117 + data1: 71543408426781 data2: 4539628424389459968 lodBias: 1 lodBiasMode: 0 + lodBiasQualityLevel: 0 maximumLODLevel: 0 maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 20 + materialQuality: 0 m_RenderingPathDefaultRealtimeReflectionFrameSettings: bitDatas: - data1: 1251973594909 + data1: 71895595679517 data2: 4539628424389459968 lodBias: 1 lodBiasMode: 0 + lodBiasQualityLevel: 0 maximumLODLevel: 0 maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 20 + materialQuality: 0 m_RenderPipelineSettings: supportShadowMask: 1 supportSSR: 0 + supportSSRTransparent: 0 supportSSAO: 1 supportSubsurfaceScattering: 1 - increaseSssSampleCount: 0 + sssSampleBudget: + m_Values: 140000002800000050000000 + m_SchemaId: + m_Id: With3Levels supportVolumetrics: 1 increaseResolutionOfVolumetrics: 0 supportLightLayers: 0 + lightLayerName0: Light Layer default + lightLayerName1: Light Layer 1 + lightLayerName2: Light Layer 2 + lightLayerName3: Light Layer 3 + lightLayerName4: Light Layer 4 + lightLayerName5: Light Layer 5 + lightLayerName6: Light Layer 6 + lightLayerName7: Light Layer 7 supportDistortion: 1 supportTransparentBackface: 1 supportTransparentDepthPrepass: 1 supportTransparentDepthPostpass: 1 colorBufferFormat: 74 + supportCustomPass: 1 + customBufferFormat: 12 supportedLitShaderMode: 1 supportDecals: 1 msaaSampleCount: 8 @@ -198,15 +232,22 @@ MonoBehaviour: supportRuntimeDebugDisplay: 0 supportDitheringCrossFade: 0 supportTerrainHole: 0 + supportProbeVolume: 0 supportRayTracing: 0 - supportedRaytracingTier: 2 + probeVolumeSettings: + atlasWidth: 128 + atlasHeight: 128 + atlasDepth: 512 + atlasOctahedralDepthWidth: 2048 + atlasOctahedralDepthHeight: 2048 lightLoopSettings: - cookieSize: 128 - cookieTexArraySize: 16 + cookieAtlasSize: 512 + cookieFormat: 74 pointCookieSize: 128 cubeCookieTexArraySize: 16 - planarReflectionProbeCacheSize: 12 - planarReflectionTextureSize: 512 + cookieAtlasLastValidMip: 0 + cookieTexArraySize: 16 + planarReflectionAtlasSize: 2048 reflectionProbeCacheSize: 64 reflectionCubemapSize: 256 reflectionCacheCompressed: 0 @@ -221,6 +262,7 @@ MonoBehaviour: maxAreaLightsOnScreen: 64 maxEnvLightsOnScreen: 64 maxDecalsOnScreen: 512 + maxPlanarReflectionOnScreen: 16 hdShadowInitParams: maxShadowRequests: 128 directionalShadowsDepthBits: 32 @@ -233,26 +275,24 @@ MonoBehaviour: shadowAtlasResolution: 4096 shadowAtlasDepthBits: 32 useDynamicViewportRescale: 1 - directionalLightsResolutionTiers: - lowQualityResolution: 256 - mediumQualityResolution: 512 - highQualityResolution: 1024 - veryHighQualityResolution: 2048 - punctualLightsResolutionTiers: - lowQualityResolution: 256 - mediumQualityResolution: 512 - highQualityResolution: 1024 - veryHighQualityResolution: 2048 - areaLightsResolutionTiers: - lowQualityResolution: 256 - mediumQualityResolution: 512 - highQualityResolution: 1024 - veryHighQualityResolution: 2048 + shadowResolutionDirectional: + m_Values: 00010000000200000004000000080000 + m_SchemaId: + m_Id: With4Levels + shadowResolutionPunctual: + m_Values: 00010000000200000004000000080000 + m_SchemaId: + m_Id: With4Levels + shadowResolutionArea: + m_Values: 00010000000200000004000000080000 + m_SchemaId: + m_Id: With4Levels maxDirectionalShadowMapResolution: 2048 maxPunctualShadowMapResolution: 2048 maxAreaShadowMapResolution: 2048 supportScreenSpaceShadows: 0 - maxScreenSpaceShadows: 2 + maxScreenSpaceShadowSlots: 4 + screenSpaceShadowBufferFormat: 48 decalSettings: drawDistance: 1000 atlasWidth: 4096 @@ -261,6 +301,7 @@ MonoBehaviour: postProcessSettings: m_LutSize: 32 lutFormat: 48 + bufferFormat: 74 dynamicResolutionSettings: enabled: 0 maxPercentage: 100 @@ -273,9 +314,59 @@ MonoBehaviour: enabled: 1 checkerboardDepthBuffer: 1 upsampleType: 1 + xrSettings: + singlePass: 1 + occlusionMesh: 1 + cameraJitter: 0 + postProcessQualitySettings: + NearBlurSampleCount: 030000000500000008000000 + NearBlurMaxRadius: + - 2 + - 4 + - 7 + FarBlurSampleCount: 04000000070000000e000000 + FarBlurMaxRadius: + - 5 + - 8 + - 13 + DoFResolution: 040000000200000001000000 + DoFHighQualityFiltering: 000101 + MotionBlurSampleCount: 04000000080000000c000000 + BloomRes: 040000000200000002000000 + BloomHighQualityFiltering: 000101 + ChromaticAberrationMaxSamples: 03000000060000000c000000 + lightSettings: + useContactShadow: + m_Values: + m_SchemaId: + m_Id: + maximumLODLevel: + m_Values: 000000000000000000000000 + m_SchemaId: + m_Id: With3Levels + lodBias: + m_Values: + - 1 + - 1 + - 1 + m_SchemaId: + m_Id: With3Levels + lightingQualitySettings: + AOStepCount: 040000000600000010000000 + AOFullRes: 000001 + AOMaximumRadiusPixels: 200000002800000050000000 + AOBilateralUpsample: 000101 + AODirectionCount: 010000000200000004000000 + ContactShadowSampleCount: 060000000a00000010000000 + SSRMaxRaySteps: 100000002000000040000000 allowShaderVariantStripping: 1 enableSRPBatcher: 1 shaderVariantLogLevel: 0 + availableMaterialQualityLevels: -1 + m_DefaultMaterialQualityLevel: 4 diffusionProfileSettings: {fileID: 0} diffusionProfileSettingsList: - {fileID: 11400000, guid: 802c802428a2d9640a87e821dfcdd9e8, type: 2} + beforeTransparentCustomPostProcesses: [] + beforePostProcessCustomPostProcesses: [] + afterPostProcessCustomPostProcesses: []