浏览代码

Cleaned up PR

/main
Paul Melamed 7 年前
当前提交
d39437c1
共有 4 个文件被更改,包括 9 次插入9 次删除
  1. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs
  2. 4
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader
  3. 4
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl
  4. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalUtilities.hlsl

8
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_MASK_B", material.GetFloat(kNormalBlendSrc) == 1.0f);
CoreUtils.SetKeyword(material, "_MAOS_BLEND_MASK_B", material.GetFloat(kMaskBlendSrc) == 1.0f);
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_MeshDecalsStrNoMask, true); // no mask always on
BlendMode blendMode = (BlendMode)material.GetFloat(kMaskBlendMode);

}
}
protected void SetupMaterialKeywordsAndPassInternal(Material material, bool perChannelMask)
protected void SetupMaterialKeywordsAndPassInternal(Material material)
{
SetupMaterialKeywordsAndPass(material);
}

maskBlendMode.floatValue = maskBlendModeValue;
foreach (var obj in m_MaterialEditor.targets)
SetupMaterialKeywordsAndPassInternal((Material)obj, perChannelMask);
SetupMaterialKeywordsAndPassInternal((Material)obj);
}
}

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


#pragma shader_feature _MASKMAP
#pragma shader_feature _ALBEDOCONTRIBUTION
#pragma shader_feature _NORMAL_BLEND_MASK_B
#pragma shader_feature _MAOS_BLEND_MASK_B
#pragma shader_feature _NORMAL_BLEND_SRC_B
#pragma shader_feature _MASK_BLEND_SRC_B
#pragma multi_compile_instancing
#pragma multi_compile _ _DECALS_PER_CHANNEL_MASK

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


maskMapBlend = surfaceData.mask.z * _DecalBlend; // store before overwriting with smoothness
surfaceData.mask.z = surfaceData.mask.w;
surfaceData.HTileMask |= DBUFFERHTILEBIT_MASK;
#if _MAOS_BLEND_MASK_B
#if _MASK_BLEND_SRC_B
surfaceData.mask.w = maskMapBlend;
#else
surfaceData.mask.w = albedoMapBlend;

#endif
surfaceData.normalWS.xyz = normalWS * 0.5f + 0.5f;
surfaceData.HTileMask |= DBUFFERHTILEBIT_NORMAL;
#if _NORMAL_BLEND_MASK_B
#if _NORMAL_BLEND_SRC_B
surfaceData.normalWS.w = maskMapBlend;
#else
surfaceData.normalWS.w = albedoMapBlend;

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


dbuffer3Mask = float2(0, 1); // _, AO alpha
}
dbuffer2.xyz = (dbuffer2Mask.xyz == 1) ? src.xyz * src.w + dbuffer2.xyz * (1.0f - src.w) : dbuffer2.xyz;
dbuffer2.xyz = (dbuffer2Mask.xyz == 1) ? src.xyz * src.w + dbuffer2.xyz * (1.0f - src.w) : dbuffer2.xyz;
dbuffer2.w = (dbuffer2Mask.w == 1) ? dbuffer2.w * (1.0f - src.w) : dbuffer2.w;
dbuffer3.xy = (dbuffer3Mask.xy == 1) ? dbuffer3.xy * (1.0f - src.w) : dbuffer3.xy;

正在加载...
取消
保存