浏览代码

Fix deferred and clear coat

/main
Sebastien Lagarde 7 年前
当前提交
d40d4830
共有 1 个文件被更改,包括 5 次插入21 次删除
  1. 26
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl

26
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl


{
NormalData normalData;
// Note: We can't handle clear coat material here, we have only one slot to store smoothness
// and the buffer is the GBuffer1.
// When using clear cloat we want to use the coat normal for the various deferred effect
// as it is the most dominant one
if (HasFeatureFlag(surfaceData.materialFeatures, MATERIALFEATUREFLAGS_LIT_CLEAR_COAT))
{
normalData.perceptualSmoothness = CLEAR_COAT_PERCEPTUAL_SMOOTHNESS;
}
else
{
normalData.perceptualSmoothness = surfaceData.perceptualSmoothness;
}
normalData.perceptualSmoothness = surfaceData.perceptualSmoothness;
return normalData;
}

DecodeFromNormalBuffer(positionSS, normalData);
surfaceData.normalWS = normalData.normalWS;
// If we have store clear coat smoothness in the texture, don't override perceptualSmoothness
// Note: Compiler is always able to optimize this code as we are in forward, so with static flag
// so the condition will be remove and the read texture will correctly happen instead of all the code
// to provide perceptualSmoothness
if (!HasFeatureFlag(surfaceData.materialFeatures, MATERIALFEATUREFLAGS_LIT_CLEAR_COAT))
{
surfaceData.perceptualSmoothness = normalData.perceptualSmoothness;
}
surfaceData.perceptualSmoothness = normalData.perceptualSmoothness;
}
//-----------------------------------------------------------------------------

// Reading normal will suffer from compression, thus using following code depends on tradeoff between performance and quality.
// Test it for your project
#define READ_FORWARD_NORMAL_FROM_TEXTURE
//#define READ_FORWARD_NORMAL_FROM_TEXTURE
#ifdef READ_FORWARD_NORMAL_FROM_TEXTURE
#if (SHADERPASS == SHADERPASS_FORWARD) && !defined(_SURFACE_TYPE_TRANSPARENT)
UpdateSurfaceDataFromNormalData(positionSS, surfaceData);

正在加载...
取消
保存