BlueRoseNote/03-UnrealEngine/Rendering/Material/使用Curve进行深度适配的Outline.md

54 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 使用Curve进行深度适配的Outline
date: 2023-07-18 14:47:24
excerpt:
tags:
rating: ⭐
---
# 前言
在UE5.1发现了若干新节点感觉对后处理描边有很大的作用。
![[MultiDraw_OutlineMaterial.png]]
UE单位为cm理论上范围为10cm~10000cm1000m。假设标准的角色身高为180cm110~200cm变化比较轻微定义一个标准数StandardCharacterHeight。
经过观察`10~StandardCharacterHeight * 2`范围适合使用CurveTexture超过StandardCharacterHeight * 2的区域基本是一个线性区间。
{360 0.5} {10000 0.018}
斜率 k = 0.0005/1cm
x轴 10=>0 , 180 => 1
-18=0 , -0.018
15 20 25 30 40 60 100
-12 -9 -7.2 -6 -4.5 -3 -1.8
0.33 0.25 0.2 0.1666 0.125 0.08333 0.05
0.667 0.75 0.8 0.83334 0.875 0.91666 0.95
最终斜率使用0.002
half invLerp(half from, half to, half value)
{
return (value - from) / (to - from);
}
half invLerpClamp(half from, half to, half value)
{
return saturate(invLerp(from,to,value));
}
// full control remap, but slower
half remap(half origFrom, half origTo, half targetFrom, half targetTo, half value)
{
half rel = invLerp(origFrom, origTo, value);
return lerp(targetFrom, targetTo, rel);
}
以下去本人设置的曲线:![[MultiDraw_OutlineCurve.png]]]