浏览代码

Merge pull request #1785 from Unity-Technologies/Remove-decal-shader-keyword

Remove _NORMAL_BLEND_SRC_B keyword in decal
/main
GitHub 6 年前
当前提交
edb6e91d
共有 8 个文件被更改,包括 52 次插入29 次删除
  1. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_All_ColorTint.mat
  2. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask.mat
  3. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_Factor05.mat
  4. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_NoAlbedo.mat
  5. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs
  6. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader
  7. 18
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl
  8. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProperties.hlsl

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_All_ColorTint.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_All_ColorTint
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _ALBEDOCONTRIBUTION _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_BlendMask
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _ALBEDOCONTRIBUTION _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_Factor05.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_BlendMask_Factor05
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _ALBEDOCONTRIBUTION _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_NoAlbedo.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_BlendMask_NoAlbedo
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs


CoreUtils.SetKeyword(material, "_COLORMAP", material.GetTexture(kBaseColorMap));
CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture(kNormalMap));
CoreUtils.SetKeyword(material, "_MASKMAP", material.GetTexture(kMaskMap));
CoreUtils.SetKeyword(material, "_NORMAL_BLEND_SRC_B", material.GetFloat(kNormalBlendSrc) == 1.0f);
CoreUtils.SetKeyword(material, "_MASK_BLEND_SRC_B", material.GetFloat(kMaskBlendSrc) == 1.0f);
material.SetShaderPassEnabled(HDShaderPassNames.s_MeshDecalsMStr, false);
material.SetShaderPassEnabled(HDShaderPassNames.s_MeshDecalsAOStr, false);

3
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader


#pragma shader_feature _MASKMAP
#pragma shader_feature _ALBEDOCONTRIBUTION
#pragma shader_feature _NORMAL_BLEND_SRC_B
#pragma shader_feature _MASK_BLEND_SRC_B
#pragma multi_compile_instancing
// No need to teset for DECALS_3RT we are in decal shader, so there is no OFF state
#pragma multi_compile _ DECALS_4RT

18
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl


surfaceData.baseColor.w = 0; // dont blend any albedo
#endif
float maskMapBlend;
// Default to _DecalBlend, if we use _NormalBlendSrc as maskmap and there is no maskmap, it mean we have 1
float maskMapBlend = _DecalBlend;
maskMapBlend = surfaceData.mask.z * _DecalBlend; // store before overwriting with smoothness
maskMapBlend *= surfaceData.mask.z; // store before overwriting with smoothness
#if _MASK_BLEND_SRC_B
surfaceData.mask.w = maskMapBlend;
#else
surfaceData.mask.w = albedoMapBlend;
#endif
surfaceData.mask.w = _MaskBlendSrc ? maskMapBlend : albedoMapBlend;
#endif
// needs to be after mask, because blend source could be in the mask map blue

#endif
surfaceData.normalWS.xyz = normalWS * 0.5f + 0.5f;
surfaceData.HTileMask |= DBUFFERHTILEBIT_NORMAL;
#if _NORMAL_BLEND_SRC_B
surfaceData.normalWS.w = maskMapBlend;
#else
surfaceData.normalWS.w = albedoMapBlend;
#endif
surfaceData.normalWS.w = _NormalBlendSrc ? maskMapBlend : albedoMapBlend;
#endif
surfaceData.MAOSBlend.xy = float2(surfaceData.mask.w, surfaceData.mask.w);
}

2
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProperties.hlsl


TEXTURE2D(_MaskMap);
SAMPLER(sampler_MaskMap);
float _NormalBlendSrc;
float _MaskBlendSrc;
float _DecalBlend;
float4 _BaseColor;
float _DecalMeshDepthBias;
正在加载...
取消
保存