This commit is contained in:
Mrhongxing committed 2026-11-16 14:20:20 +08:00
commit cebe21db2e
46 files changed
+10008

No files matched your search

@@ -0,0 +1,25 @@
// 官方版本的RampShadowID函数
float RampShadowID(float input, float useShadow2, float useShadow3, float useShadow4, float useShadow5,
float shadowValue1, float shadowValue2, float shadowValue3, float shadowValue4, float shadowValue5)
{
// 根据input值将模型分为5个区域
float v1 = step(0.6, input) * step(input, 0.8); // 0.6-0.8区域
float v2 = step(0.4, input) * step(input, 0.6); // 0.4-0.6区域
float v3 = step(0.2, input) * step(input, 0.4); // 0.2-0.4区域
float v4 = step(input, 0.2); // 0-0.2区域
// 根据开关控制是否使用不同材质的值
float blend12 = lerp(shadowValue1, shadowValue2, useShadow2);
float blend15 = lerp(shadowValue1, shadowValue5, useShadow5);
float blend13 = lerp(shadowValue1, shadowValue3, useShadow3);
float blend14 = lerp(shadowValue1, shadowValue4, useShadow4);
// 根据区域选择对应的材质值
float result = blend12; // 默认使用材质1或2
result = lerp(result, blend15, v1); // 0.6-0.8区域使用材质5
result = lerp(result, blend13, v2); // 0.4-0.6区域使用材质3
result = lerp(result, blend14, v3); // 0.2-0.4区域使用材质4
result = lerp(result, shadowValue1, v4); // 0-0.2区域使用材质1
return result;
}