Skip to content

Commit a728463

Browse files
Alpha to coverage frame setting (#33)
* Added FrameSettingsField.AlphaToMask * Changelog + Documentation * Changed field index
1 parent 2e8bb07 commit a728463

File tree

5 files changed

+126
-28
lines changed

5 files changed

+126
-28
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9797
- Added support for alpha to coverage for HDRP shaders and shader graph
9898
- Added support for Quality Levels to Subsurface Scattering.
9999
- Added option to disable XR rendering on the camera settings.
100+
- Added a frame setting for alpha to mask.
100101

101102
### Fixed
102103
- Fix when rescale probe all direction below zero (1219246)

com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ These settings determine the method that the Cameras and Reflection Probes using
2828
| - **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**. |
2929
| - **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**. |
3030
| - **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**. |
31+
| - **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**.")]
3132
| **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. |
3233
| **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. |
3334
| **Decals** | Enable the checkbox to make HDRP process decals. Enable this on cameras that you want to render decals. |

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ DepthPrepassParameters PrepareDepthPrepass(CullingResults cull, HDCamera hdCamer
30503050
result.profilingId = HDProfileId.DepthPrepassForward;
30513051

30523052
RenderStateBlock? stateBlock = null;
3053-
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA))
3053+
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.AlphaToMask))
30543054
stateBlock = m_AlphaToMaskBlock;
30553055

30563056
result.mrtRendererListDesc = CreateOpaqueRendererListDesc( cull, hdCamera.camera, m_DepthOnlyAndDepthForwardOnlyPassNames, stateBlock: stateBlock, excludeObjectMotionVectors: objectMotionEnabled);
@@ -3804,7 +3804,7 @@ void RenderObjectsMotionVectors(CullingResults cullResults, HDCamera hdCamera, S
38043804
cmd.SetGlobalInt(HDShaderIDs._ColorMaskNormal, hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA) ? (int)ColorWriteMask.All : 0);
38053805

38063806
RenderStateBlock? stateBlock = null;
3807-
if (hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred || !hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA))
3807+
if (hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred || !hdCamera.frameSettings.IsEnabled(FrameSettingsField.AlphaToMask))
38083808
stateBlock = m_AlphaToMaskBlock;
38093809

38103810
CoreUtils.SetRenderTarget(cmd, m_SharedRTManager.GetMotionVectorsPassBuffersRTI(hdCamera.frameSettings), m_SharedRTManager.GetDepthStencilBuffer(hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA)));

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ public enum FrameSettingsField
102102
/// <summary>When enabled, Cameras using these Frame Settings calculate MSAA when they render the Scene. Set Lit Shader Mode to Forward to access this option.</summary>
103103
[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.")]
104104
MSAA = 31,
105+
/// <summary>When enabled, Cameras using these Frame Settings use Alpha To Mask. Activate MSAA to access this option.</summary>
106+
[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.")]
107+
AlphaToMask = 56,
105108
/// <summary>When enabled, Cameras using these Frame Settings render opaque GameObjects.</summary>
106109
[FrameSettingsField(0, autoName: OpaqueObjects, customOrderInGroup: 4, tooltip: "When enabled, Cameras using these Frame Settings render opaque GameObjects.")]
107110
OpaqueObjects = 2,
@@ -422,6 +425,7 @@ partial struct FrameSettings
422425
(uint)FrameSettingsField.SkyReflection,
423426
(uint)FrameSettingsField.DirectSpecularLighting,
424427
(uint)FrameSettingsField.RayTracing,
428+
(uint)FrameSettingsField.AlphaToMask,
425429
(uint)FrameSettingsField.ProbeVolume,
426430
}),
427431
lodBias = 1,
@@ -730,6 +734,7 @@ internal static void Sanitize(ref FrameSettings sanitizedFrameSettings, Camera c
730734
//MSAA only supported in forward
731735
// TODO: The work will be implemented piecemeal to support all passes
732736
bool msaa = sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.MSAA] &= renderPipelineSettings.supportMSAA && sanitizedFrameSettings.litShaderMode == LitShaderMode.Forward;
737+
sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.AlphaToMask] &= msaa;
733738

734739
// No recursive reflections
735740
sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.SSR] &= renderPipelineSettings.supportSSR && !msaa && !preview;

com.unity.testing.hdrp/RP_Assets/HDRP_Test_Def_MSAAForward.asset

Lines changed: 117 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: 0cf1dab834d4ec34195b920ea7bbf9ec, type: 3}
1313
m_Name: HDRP_Test_Def_MSAAForward
1414
m_EditorClassIdentifier:
15-
m_Version: 7
15+
m_Version: 15
1616
m_ObsoleteFrameSettings:
1717
overrides: 0
1818
enableShadow: 0
@@ -153,60 +153,101 @@ MonoBehaviour:
153153
m_RenderPipelineRayTracingResources: {fileID: 0}
154154
m_DefaultVolumeProfile: {fileID: 11400000, guid: aea7ff43876258748be47d8751e0e9d5,
155155
type: 2}
156+
m_DefaultLookDevProfile: {fileID: 11400000, guid: 254c4fe87beb7be4fa72e1681edbed02,
157+
type: 2}
156158
m_RenderingPathDefaultCameraFrameSettings:
157159
bitDatas:
158-
data1: 1288481013532
160+
data1: 72130075896840028
159161
data2: 4539628424657829888
160162
lodBias: 1
161163
lodBiasMode: 0
164+
lodBiasQualityLevel: 0
162165
maximumLODLevel: 0
163166
maximumLODLevelMode: 0
167+
maximumLODLevelQualityLevel: 0
168+
sssQualityMode: 0
169+
sssQualityLevel: 0
170+
sssCustomSampleBudget: 20
171+
materialQuality: 0
164172
m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings:
165173
bitDatas:
166-
data1: 1174664249117
174+
data1: 71543408426781
167175
data2: 4539628424389459968
168176
lodBias: 1
169177
lodBiasMode: 0
178+
lodBiasQualityLevel: 0
170179
maximumLODLevel: 0
171180
maximumLODLevelMode: 0
181+
maximumLODLevelQualityLevel: 0
182+
sssQualityMode: 0
183+
sssQualityLevel: 0
184+
sssCustomSampleBudget: 20
185+
materialQuality: 0
172186
m_RenderingPathDefaultRealtimeReflectionFrameSettings:
173187
bitDatas:
174-
data1: 1251973594909
188+
data1: 71895595679517
175189
data2: 4539628424389459968
176190
lodBias: 1
177191
lodBiasMode: 0
192+
lodBiasQualityLevel: 0
178193
maximumLODLevel: 0
179194
maximumLODLevelMode: 0
195+
maximumLODLevelQualityLevel: 0
196+
sssQualityMode: 0
197+
sssQualityLevel: 0
198+
sssCustomSampleBudget: 20
199+
materialQuality: 0
180200
m_RenderPipelineSettings:
181201
supportShadowMask: 1
182202
supportSSR: 0
203+
supportSSRTransparent: 0
183204
supportSSAO: 1
184205
supportSubsurfaceScattering: 1
185-
increaseSssSampleCount: 0
206+
sssSampleBudget:
207+
m_Values: 140000002800000050000000
208+
m_SchemaId:
209+
m_Id: With3Levels
186210
supportVolumetrics: 1
187211
increaseResolutionOfVolumetrics: 0
188212
supportLightLayers: 0
213+
lightLayerName0: Light Layer default
214+
lightLayerName1: Light Layer 1
215+
lightLayerName2: Light Layer 2
216+
lightLayerName3: Light Layer 3
217+
lightLayerName4: Light Layer 4
218+
lightLayerName5: Light Layer 5
219+
lightLayerName6: Light Layer 6
220+
lightLayerName7: Light Layer 7
189221
supportDistortion: 1
190222
supportTransparentBackface: 1
191223
supportTransparentDepthPrepass: 1
192224
supportTransparentDepthPostpass: 1
193225
colorBufferFormat: 74
226+
supportCustomPass: 1
227+
customBufferFormat: 12
194228
supportedLitShaderMode: 1
195229
supportDecals: 1
196230
msaaSampleCount: 8
197231
supportMotionVectors: 1
198232
supportRuntimeDebugDisplay: 0
199233
supportDitheringCrossFade: 0
200234
supportTerrainHole: 0
235+
supportProbeVolume: 0
201236
supportRayTracing: 0
202-
supportedRaytracingTier: 2
237+
probeVolumeSettings:
238+
atlasWidth: 128
239+
atlasHeight: 128
240+
atlasDepth: 512
241+
atlasOctahedralDepthWidth: 2048
242+
atlasOctahedralDepthHeight: 2048
203243
lightLoopSettings:
204-
cookieSize: 128
205-
cookieTexArraySize: 16
244+
cookieAtlasSize: 512
245+
cookieFormat: 74
206246
pointCookieSize: 128
207247
cubeCookieTexArraySize: 16
208-
planarReflectionProbeCacheSize: 12
209-
planarReflectionTextureSize: 512
248+
cookieAtlasLastValidMip: 0
249+
cookieTexArraySize: 16
250+
planarReflectionAtlasSize: 2048
210251
reflectionProbeCacheSize: 64
211252
reflectionCubemapSize: 256
212253
reflectionCacheCompressed: 0
@@ -221,6 +262,7 @@ MonoBehaviour:
221262
maxAreaLightsOnScreen: 64
222263
maxEnvLightsOnScreen: 64
223264
maxDecalsOnScreen: 512
265+
maxPlanarReflectionOnScreen: 16
224266
hdShadowInitParams:
225267
maxShadowRequests: 128
226268
directionalShadowsDepthBits: 32
@@ -233,26 +275,24 @@ MonoBehaviour:
233275
shadowAtlasResolution: 4096
234276
shadowAtlasDepthBits: 32
235277
useDynamicViewportRescale: 1
236-
directionalLightsResolutionTiers:
237-
lowQualityResolution: 256
238-
mediumQualityResolution: 512
239-
highQualityResolution: 1024
240-
veryHighQualityResolution: 2048
241-
punctualLightsResolutionTiers:
242-
lowQualityResolution: 256
243-
mediumQualityResolution: 512
244-
highQualityResolution: 1024
245-
veryHighQualityResolution: 2048
246-
areaLightsResolutionTiers:
247-
lowQualityResolution: 256
248-
mediumQualityResolution: 512
249-
highQualityResolution: 1024
250-
veryHighQualityResolution: 2048
278+
shadowResolutionDirectional:
279+
m_Values: 00010000000200000004000000080000
280+
m_SchemaId:
281+
m_Id: With4Levels
282+
shadowResolutionPunctual:
283+
m_Values: 00010000000200000004000000080000
284+
m_SchemaId:
285+
m_Id: With4Levels
286+
shadowResolutionArea:
287+
m_Values: 00010000000200000004000000080000
288+
m_SchemaId:
289+
m_Id: With4Levels
251290
maxDirectionalShadowMapResolution: 2048
252291
maxPunctualShadowMapResolution: 2048
253292
maxAreaShadowMapResolution: 2048
254293
supportScreenSpaceShadows: 0
255-
maxScreenSpaceShadows: 2
294+
maxScreenSpaceShadowSlots: 4
295+
screenSpaceShadowBufferFormat: 48
256296
decalSettings:
257297
drawDistance: 1000
258298
atlasWidth: 4096
@@ -261,6 +301,7 @@ MonoBehaviour:
261301
postProcessSettings:
262302
m_LutSize: 32
263303
lutFormat: 48
304+
bufferFormat: 74
264305
dynamicResolutionSettings:
265306
enabled: 0
266307
maxPercentage: 100
@@ -273,9 +314,59 @@ MonoBehaviour:
273314
enabled: 1
274315
checkerboardDepthBuffer: 1
275316
upsampleType: 1
317+
xrSettings:
318+
singlePass: 1
319+
occlusionMesh: 1
320+
cameraJitter: 0
321+
postProcessQualitySettings:
322+
NearBlurSampleCount: 030000000500000008000000
323+
NearBlurMaxRadius:
324+
- 2
325+
- 4
326+
- 7
327+
FarBlurSampleCount: 04000000070000000e000000
328+
FarBlurMaxRadius:
329+
- 5
330+
- 8
331+
- 13
332+
DoFResolution: 040000000200000001000000
333+
DoFHighQualityFiltering: 000101
334+
MotionBlurSampleCount: 04000000080000000c000000
335+
BloomRes: 040000000200000002000000
336+
BloomHighQualityFiltering: 000101
337+
ChromaticAberrationMaxSamples: 03000000060000000c000000
338+
lightSettings:
339+
useContactShadow:
340+
m_Values:
341+
m_SchemaId:
342+
m_Id:
343+
maximumLODLevel:
344+
m_Values: 000000000000000000000000
345+
m_SchemaId:
346+
m_Id: With3Levels
347+
lodBias:
348+
m_Values:
349+
- 1
350+
- 1
351+
- 1
352+
m_SchemaId:
353+
m_Id: With3Levels
354+
lightingQualitySettings:
355+
AOStepCount: 040000000600000010000000
356+
AOFullRes: 000001
357+
AOMaximumRadiusPixels: 200000002800000050000000
358+
AOBilateralUpsample: 000101
359+
AODirectionCount: 010000000200000004000000
360+
ContactShadowSampleCount: 060000000a00000010000000
361+
SSRMaxRaySteps: 100000002000000040000000
276362
allowShaderVariantStripping: 1
277363
enableSRPBatcher: 1
278364
shaderVariantLogLevel: 0
365+
availableMaterialQualityLevels: -1
366+
m_DefaultMaterialQualityLevel: 4
279367
diffusionProfileSettings: {fileID: 0}
280368
diffusionProfileSettingsList:
281369
- {fileID: 11400000, guid: 802c802428a2d9640a87e821dfcdd9e8, type: 2}
370+
beforeTransparentCustomPostProcesses: []
371+
beforePostProcessCustomPostProcesses: []
372+
afterPostProcessCustomPostProcesses: []

0 commit comments

Comments
 (0)