浏览代码

address some PR comments

/main
Paul Melamed 6 年前
当前提交
60d9cb71
共有 4 个文件被更改,包括 19 次插入12 次删除
  1. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs
  2. 7
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/Decal.hlsl
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/DecalData.hlsl
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/DecalUtilities.hlsl

20
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs


void UpdateTextureCache(CommandBuffer cmd)
{
if ((m_DiffuseTexIndex == -1) && (m_DiffuseTexture != null))
if (m_DiffuseTexture != null)
if ((m_NormalTexIndex == -1) && (m_NormalTexture != null))
else
{
m_DiffuseTexIndex = -1;
}
if (m_NormalTexture != null)
if ((m_MaskTexIndex == -1) && (m_MaskTexture != null))
else
{
m_NormalTexIndex = -1;
}
if (m_MaskTexture != null)
}
else
{
m_MaskTexIndex = -1;
}
}

7
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/Decal.hlsl


TEXTURE2D_ARRAY(_DecalAtlas);
SAMPLER(sampler_DecalAtlas);
// define these specifically for decal normal map sampling to not be dependent on surface gradient
#if defined(UNITY_NO_DXT5nm)
#define DECAL_UNPACK_NORMAL_FUNC UnpackNormalRGB
#else
#define DECAL_UNPACK_NORMAL_FUNC UnpackNormalmapRGorAG
#endif
// Must be in sync with RT declared in HDRenderPipeline.cs ::Rebuild
void EncodeIntoDBuffer( DecalSurfaceData surfaceData,
out DBufferType0 outDBuffer0,

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/DecalData.hlsl


surfaceData.HTileMask |= DBUFFERHTILEBIT_DIFFUSE;
#endif
#if _NORMALMAP
surfaceData.normalWS.xyz = mul((float3x3)decalToWorld, DECAL_UNPACK_NORMAL_FUNC(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, texCoordDS))) * 0.5f + 0.5f;
surfaceData.normalWS.xyz = mul((float3x3)decalToWorld, UnpackNormalmapRGorAG(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, texCoordDS))) * 0.5f + 0.5f;
surfaceData.normalWS.w = totalBlend;
surfaceData.HTileMask |= DBUFFERHTILEBIT_NORMAL;
#endif

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/DecalUtilities.hlsl


void ApplyBlendNormal(inout float4 dst, inout int matMask, float2 texCoords, int sliceIndex, int mapMask, float3x3 decalToWorld, float blend)
{
float4 src;
src.xyz = mul(decalToWorld, DECAL_UNPACK_NORMAL_FUNC(SAMPLE_TEXTURE2D_ARRAY(_DecalAtlas, sampler_DecalAtlas, texCoords, sliceIndex))) * 0.5f + 0.5f;
src.xyz = mul(decalToWorld, UnpackNormalmapRGorAG(SAMPLE_TEXTURE2D_ARRAY(_DecalAtlas, sampler_DecalAtlas, texCoords, sliceIndex))) * 0.5f + 0.5f;
src.w = blend;
dst.xyz = src.xyz * src.w + dst.xyz * (1.0f - src.w);
dst.w = dst.w * (1.0f - src.w);

正在加载...
取消
保存