v1.0
This commit is contained in:
commit
cebe21db2e
46 files changed
+10008
No files matched your search
Executable
+14
@@ -0,0 +1,14 @@
|
||||
half3 LpU = dot(L, headUpDir) / pow(length(headUpDir), 2) * headUpDir; // 计算光源方向在面部上方的投影
|
||||
half3 LpHeadHorizon = normalize(L- LpU); // 光照方向在头部水平面上的投影
|
||||
half value = acos(dot(LpHeadHorizon, headRightDir)) / 3.141592654; // 计算光照方向与面部右方的夹角
|
||||
half exposeRight = step(value, 0.5); // 判断光照是来自右侧还是左侧
|
||||
half valueR = pow(1 - value * 2, 3); // 右侧阴影强度
|
||||
half valueL = pow(value * 2 - 1, 3); // 左侧阴影强度
|
||||
half mixValue = lerp(valueL, valueR, exposeRight); // 混合阴影强度
|
||||
half sdfLeft = tex2D(_SDF, half2(1 - input.uv0.x, input.uv0.y)).r; // 左侧距离场
|
||||
half sdfRight = tex2D(_SDF, input.uv0).r; // 右侧距离场
|
||||
half mixSdf = lerp(sdfRight, sdfLeft, exposeRight); // 采样SDF纹理
|
||||
half sdf = step(mixValue, mixSdf); // 计算硬边界阴影
|
||||
sdf = lerp(0, sdf, step(0, dot(LpHeadHorizon, headForwardDir))); // 计算右侧阴影
|
||||
sdf *= shadowMask.g; // 使用G通道控制阴影强度
|
||||
sdf = lerp(sdf, 1, shadowMask.a); // 使用A通道作为阴影遮罩
|
||||
Reference in new issue
Block a user