浏览代码

Updated base color inheritance to avoid getting negative values.

/fptl_cleanup
Julien Ignace 7 年前
当前提交
33f05db9
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 5
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl

5
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


// If we inherit from base layer, we will add a bit of it
// 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);
// saturate(influenceFactor * (baseColor0 - meanColor) + baseColor);
// There is a special case when baseColor < meanColor to avoid getting negative values.
float3 factor = baseColor > meanColor ? (baseColor0 - meanColor) : (baseColor0 * baseColor / meanColor - baseColor);
return influenceFactor * factor + baseColor;
}
void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)

正在加载...
取消
保存