浏览代码

HDRenderPipeline: Small tweak for artists on layered material

/main
sebastienlagarde 8 年前
当前提交
cc4b8c9f
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 7
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl

7
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl


float influenceFactor = BlendLayeredScalar(0.0, _InheritBaseNormal1, _InheritBaseNormal2, _InheritBaseNormal3, weights);
// We will add smoothly the contribution of the normal map by using lower mips with help of bias sampling. InfluenceFactor must be [0..numMips] // Caution it cause banding...
// Note: that we don't take details map into account here.
float3 mainNormalTS = GetNormalTS0(input, layerTexCoord, float3(0.0, 0.0, 1.0), 0.0, true, 2.0);
float maxMipBias = log2(max(_NormalMap0_TexelSize.z, _NormalMap0_TexelSize.w)); // don't do + 1 as it is for bias, not lod
float3 mainNormalTS = GetNormalTS0(input, layerTexCoord, float3(0.0, 0.0, 1.0), 0.0, true, maxMipBias * (1.0 - influenceFactor));
// Add on our regular normal a bit of Main Layer normal base on influence factor. Note that this affect only the "visible" normal.
return lerp(normalTS, BlendNormalRNM(normalTS, mainNormalTS), influenceFactor);

float3 meanColor = BlendLayeredVector3(baseMeanColor0, baseMeanColor1, baseMeanColor2, baseMeanColor3, weights);
// If we inherit from base layer, we will add a bit of it
return influenceFactor * (baseColor0 - meanColor) + baseColor;
// We add variance of current visible level and the base color 0 or mean (to retrieve initial color) depends on influence
// (baseColor - meanColor) + lerp(meanColor, baseColor0, inheritBaseColor) simplify to
return saturate(influenceFactor * (baseColor0 - meanColor) + baseColor);
}
// Caution: Blend mask are Layer 1 R - Layer 2 G - Layer 3 B - Main Layer A

正在加载...
取消
保存