浏览代码

Remove _NORMAL_BLEND_SRC_B keyword in decal

/main
Evgenii Golubev 6 年前
当前提交
0798e2ee
共有 4 个文件被更改,包括 8 次插入17 次删除
  1. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs
  2. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader
  3. 18
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl
  4. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProperties.hlsl

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;
正在加载...
取消
保存