@@ -18,21 +18,19 @@ sealed partial class DecalSubTarget : HDSubTarget, ILegacyTarget, IRequiresData<
1818 {
1919 public DecalSubTarget ( ) => displayName = "Decal" ;
2020
21- public static string passTemplatePath => $ "{ HDUtils . GetHDRenderPipelinePath ( ) } Editor/Material/Decal/ShaderGraph/DecalPass.template";
22-
23- static string [ ] passTemplateMaterialDirectories = new string [ ]
21+ protected override string templatePath => $ "{ HDUtils . GetHDRenderPipelinePath ( ) } Editor/Material/Decal/ShaderGraph/DecalPass.template";
22+ protected override string [ ] templateMaterialDirectories => new string [ ]
2423 {
2524 $ "{ HDUtils . GetHDRenderPipelinePath ( ) } Editor/Material/ShaderGraph/Templates",
2625 $ "{ HDUtils . GetHDRenderPipelinePath ( ) } Editor/Material/ShaderGraph/Templates/"
2726 } ;
28-
29- protected override string templatePath => passTemplatePath ;
30- protected override string [ ] templateMaterialDirectories => passTemplateMaterialDirectories ;
3127 protected override string subTargetAssetGuid => "3ec927dfcb5d60e4883b2c224857b6c2" ;
3228 protected override string customInspector => "Rendering.HighDefinition.DecalGUI" ;
3329 protected override string renderType => HDRenderTypeTags . Opaque . ToString ( ) ;
3430 protected override string renderQueue => HDRenderQueue . GetShaderTagValue ( HDRenderQueue . ChangeType ( HDRenderQueue . RenderQueueType . Opaque , decalData . drawOrder , false , false ) ) ;
3531 protected override ShaderID shaderID => HDShaderUtils . ShaderID . SG_Lit ;
32+ protected override FieldDescriptor subShaderField => new FieldDescriptor ( kSubShader , "Decal Subshader" , "" ) ;
33+ protected override string subShaderInclude => "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.hlsl" ;
3634
3735 // Material Data
3836 DecalData m_DecalData ;
@@ -53,7 +51,12 @@ public DecalData decalData
5351
5452 protected override IEnumerable < SubShaderDescriptor > EnumerateSubShaders ( )
5553 {
56- yield return SubShaders . Decal ;
54+ yield return PostProcessSubShader ( SubShaders . Decal ) ;
55+ }
56+
57+ protected override void CollectPassKeywords ( ref PassDescriptor pass )
58+ {
59+ pass . keywords . Add ( CoreKeywordDescriptors . AlphaTest , new FieldCondition ( Fields . AlphaTest , true ) ) ;
5760 }
5861
5962 public static FieldDescriptor AffectsAlbedo = new FieldDescriptor ( kMaterial , "AffectsAlbedo" , "_MATERIAL_AFFECTS_ALBEDO 1" ) ;
@@ -127,7 +130,6 @@ static class SubShaders
127130 {
128131 public static SubShaderDescriptor Decal = new SubShaderDescriptor ( )
129132 {
130- pipelineTag = HDRenderPipeline . k_ShaderTagName ,
131133 generatesPreview = true ,
132134 passes = new PassCollection
133135 {
@@ -156,10 +158,6 @@ public static class DecalPasses
156158 lightMode = DecalSystem . s_MaterialSGDecalPassNames [ ( int ) DecalSystem . MaterialSGDecalPass . ShaderGraph_DBufferProjector3RT ] ,
157159 useInPreview = false ,
158160
159- // Template
160- passTemplatePath = passTemplatePath ,
161- sharedTemplateDirectories = passTemplateMaterialDirectories ,
162-
163161 // Port mask
164162 validPixelBlocks = DecalBlockMasks . FragmentDefault ,
165163
@@ -180,10 +178,6 @@ public static class DecalPasses
180178 lightMode = DecalSystem . s_MaterialSGDecalPassNames [ ( int ) DecalSystem . MaterialSGDecalPass . ShaderGraph_DBufferProjector4RT ] ,
181179 useInPreview = false ,
182180
183- // Template
184- passTemplatePath = passTemplatePath ,
185- sharedTemplateDirectories = passTemplateMaterialDirectories ,
186-
187181 // Port mask
188182 validPixelBlocks = DecalBlockMasks . FragmentDefault ,
189183
@@ -206,10 +200,6 @@ public static class DecalPasses
206200 lightMode = DecalSystem . s_MaterialSGDecalPassNames [ ( int ) DecalSystem . MaterialSGDecalPass . ShaderGraph_ProjectorEmissive ] ,
207201 useInPreview = false ,
208202
209- // Template
210- passTemplatePath = passTemplatePath ,
211- sharedTemplateDirectories = passTemplateMaterialDirectories ,
212-
213203 // Port mask
214204 validPixelBlocks = DecalBlockMasks . FragmentEmissive ,
215205
@@ -231,10 +221,6 @@ public static class DecalPasses
231221 lightMode = DecalSystem . s_MaterialSGDecalPassNames [ ( int ) DecalSystem . MaterialSGDecalPass . ShaderGraph_DBufferMesh3RT ] ,
232222 useInPreview = false ,
233223
234- // Template
235- passTemplatePath = passTemplatePath ,
236- sharedTemplateDirectories = passTemplateMaterialDirectories ,
237-
238224 // Port mask
239225 validPixelBlocks = DecalBlockMasks . FragmentDefault ,
240226
@@ -258,10 +244,6 @@ public static class DecalPasses
258244 lightMode = DecalSystem . s_MaterialSGDecalPassNames [ ( int ) DecalSystem . MaterialSGDecalPass . ShaderGraph_DBufferMesh4RT ] ,
259245 useInPreview = false ,
260246
261- // Template
262- passTemplatePath = passTemplatePath ,
263- sharedTemplateDirectories = passTemplateMaterialDirectories ,
264-
265247 // Port mask
266248 validPixelBlocks = DecalBlockMasks . FragmentDefault ,
267249
@@ -285,10 +267,6 @@ public static class DecalPasses
285267 lightMode = DecalSystem . s_MaterialSGDecalPassNames [ ( int ) DecalSystem . MaterialSGDecalPass . ShaderGraph_MeshEmissive ] ,
286268 useInPreview = false ,
287269
288- // Template
289- passTemplatePath = passTemplatePath ,
290- sharedTemplateDirectories = passTemplateMaterialDirectories ,
291-
292270 // Port mask
293271 validPixelBlocks = DecalBlockMasks . FragmentMeshEmissive ,
294272
@@ -311,10 +289,6 @@ public static class DecalPasses
311289 lightMode = "ForwardOnly" ,
312290 useInPreview = true ,
313291
314- // Template
315- passTemplatePath = passTemplatePath ,
316- sharedTemplateDirectories = passTemplateMaterialDirectories ,
317-
318292 // Port mask
319293 validPixelBlocks = DecalBlockMasks . FragmentMeshEmissive ,
320294
@@ -592,7 +566,6 @@ static class Descriptors
592566 } ;
593567 }
594568#endregion
595- // protected override IncludeCollection subShaderIncludes => "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.hlsl";
596569
597570#region Includes
598571 static class DecalIncludes
0 commit comments