WL #963 ① 남은 일 — 비수 1·2타 호 녹색: 공용 호 셰이더(SH_Master_improved)가 재질 _UseCustomdata_Color 1 이면 정점색 대신 사용자 데이터 2(청록 HDR 그라디언트)를 색으로 써서 시작색만 바꾸던 WLArcTint 가 안 먹혔음 → 사용자 데이터 Color 모드 그라디언트도 직업 색조로(모드 유지) · 원래 값 깊은 복사(GetColor 그라디언트가 모듈 값을 가리켜 묵광 등 다른 근접 직업 호에 녹색이 남던 복원 실패 실측 → 복원) · 직업 10202 색 colorAdditive (0.3,1.4,0.6)→(0.25,1.5,0.35) · colorAlpha (0.15,0.95,0.45)→(0.12,0.95,0.2)(화면 민트 152~163° → 녹색 134°)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-10-21 18:56:06 +09:00
parent 6257226e86
commit 062d4b12ae
2 changed files with 49 additions and 7 deletions

View File

@ -6,6 +6,8 @@
// 색은 입자 시작색이라 직업 궤적 색(SlashTrailSettings 직업 덮기 colorAdditive)이 닿지 않았다(Play 캡처 · 렌더러 목록).
// ■ 처리 — WeaponTrailDriver 호 배치 직후 훅 1줄: 그 직업 덮기의 overrideLook 이 켜져 있으면 호 입자(살아 있는 것 + 다음 분출)의 색을
// colorAdditive 색조(명도 · 알파는 원래 값)로 · 아니면 이 인스턴스의 원래 시작색으로 되돌린다(풀 공유).
// ■ 2차(#963 남은 일) — 시작색만 바꾸니 화면은 녹청: 재질 _UseCustomdata_Color 1 이면 셰이더(SH_Master_improved Branch)가 정점색 대신
// 사용자 데이터 2(Custom Data Color · 청록 HDR 그라디언트)를 색으로 쓴다 → 그 그라디언트도 같은 색조로 · 되돌릴 때 원래 값(깊은 복사).
// 🔴 Debug.LogError 금지.
// ─────────────────────────────────────────────────────────────────────────────
using UnityEngine;
@ -16,8 +18,13 @@ namespace WL.Combat
{
public static int Tinted, Restored;
static ParticleSystem.Particle[] s_buf = new ParticleSystem.Particle[256];
static readonly ParticleSystemCustomData[] s_streams = { ParticleSystemCustomData.Custom1, ParticleSystemCustomData.Custom2 };
sealed class Orig : MonoBehaviour { public ParticleSystem[] ps; public ParticleSystem.MinMaxGradient[] col; public bool tinted; }
sealed class Orig : MonoBehaviour
{
public ParticleSystem[] ps; public ParticleSystem.MinMaxGradient[] col; public bool tinted;
public ParticleSystem.MinMaxGradient[,] cd; public bool[,] hasCd; // [입자계, 사용자 데이터 1·2] Color 모드 원래 값
}
public static void Apply(GameObject arc, SlashTrailClassOverride cov)
{
@ -28,7 +35,15 @@ namespace WL.Combat
if (o == null)
{
o = arc.AddComponent<Orig>(); o.ps = arc.GetComponentsInChildren<ParticleSystem>(true);
o.col = new ParticleSystem.MinMaxGradient[o.ps.Length]; for (int i = 0; i < o.ps.Length; i++) o.col[i] = o.ps[i].main.startColor;
o.col = new ParticleSystem.MinMaxGradient[o.ps.Length];
o.cd = new ParticleSystem.MinMaxGradient[o.ps.Length, 2]; o.hasCd = new bool[o.ps.Length, 2];
for (int i = 0; i < o.ps.Length; i++) // 원래 값은 깊은 복사 — GetColor 그라디언트는 모듈 값을 그대로 가리켜 색조를 입히면 같이 바뀐다(묵광 복원 실패 실측)
{
o.col[i] = Copy(o.ps[i].main.startColor);
var cdm = o.ps[i].customData; if (!cdm.enabled) continue;
for (int k = 0; k < 2; k++)
if (cdm.GetMode(s_streams[k]) == ParticleSystemCustomDataMode.Color) { o.hasCd[i, k] = true; o.cd[i, k] = Copy(cdm.GetColor(s_streams[k])); }
}
}
bool want = cov != null && cov.overrideLook;
if (!want && !o.tinted) return;
@ -38,6 +53,9 @@ namespace WL.Combat
{
var ps = o.ps[i]; if (ps == null) continue;
var m = ps.main;
var cdm = ps.customData; // 사용자 데이터 색은 나이에 따라 매 프레임 계산 → 살아 있는 입자에도 바로 닿는다
for (int k = 0; k < 2; k++)
if (o.hasCd[i, k]) cdm.SetColor(s_streams[k], want ? Retint(o.cd[i, k], th, ts) : o.cd[i, k]);
if (!want) { m.startColor = o.col[i]; continue; }
m.startColor = Retint(o.col[i], th, ts);
int n = ps.GetParticles(s_buf); // 이미 나온 입자(호는 생성 순간 한 번에 분출)
@ -50,16 +68,40 @@ namespace WL.Combat
}
static Color Hue(Color c, float th, float ts) { float h, s, v; Color.RGBToHSV(c, out h, out s, out v); var r = Color.HSVToRGB(th, Mathf.Max(s, ts * 0.6f), v); r.a = c.a; return r; }
static Gradient Hue(Gradient g, float th, float ts)
{
if (g == null) return null;
var ng = new Gradient(); var ks = g.colorKeys; for (int k = 0; k < ks.Length; k++) ks[k].color = Hue(ks[k].color, th, ts);
ng.SetKeys(ks, g.alphaKeys); ng.mode = g.mode; ng.colorSpace = g.colorSpace; return ng;
}
static Gradient Clone(Gradient g)
{
if (g == null) return null;
var ng = new Gradient(); ng.SetKeys(g.colorKeys, g.alphaKeys); ng.mode = g.mode; ng.colorSpace = g.colorSpace; return ng;
}
static ParticleSystem.MinMaxGradient Copy(ParticleSystem.MinMaxGradient g)
{
switch (g.mode)
{
case ParticleSystemGradientMode.TwoGradients: return new ParticleSystem.MinMaxGradient(Clone(g.gradientMin), Clone(g.gradientMax));
case ParticleSystemGradientMode.Gradient:
case ParticleSystemGradientMode.RandomColor:
var r = new ParticleSystem.MinMaxGradient(Clone(g.gradient)); r.mode = g.mode; return r;
default: return g; // 단색 · 두 색 = 값
}
}
static ParticleSystem.MinMaxGradient Retint(ParticleSystem.MinMaxGradient g, float th, float ts)
{
switch (g.mode)
{
case ParticleSystemGradientMode.Color: return new ParticleSystem.MinMaxGradient(Hue(g.color, th, ts));
case ParticleSystemGradientMode.TwoColors: return new ParticleSystem.MinMaxGradient(Hue(g.colorMin, th, ts), Hue(g.colorMax, th, ts));
default:
case ParticleSystemGradientMode.TwoGradients:
if (g.gradientMin == null || g.gradientMax == null) return g;
return new ParticleSystem.MinMaxGradient(Hue(g.gradientMin, th, ts), Hue(g.gradientMax, th, ts));
default: // Gradient · RandomColor(모드 유지)
if (g.gradient == null) return g;
var ng = new Gradient(); var ks = g.gradient.colorKeys; for (int k = 0; k < ks.Length; k++) ks[k].color = Hue(ks[k].color, th, ts);
ng.SetKeys(ks, g.gradient.alphaKeys); return new ParticleSystem.MinMaxGradient(ng);
var r = new ParticleSystem.MinMaxGradient(Hue(g.gradient, th, ts)); r.mode = g.mode; return r;
}
}
}

View File

@ -142,8 +142,8 @@ MonoBehaviour:
- classId: 10202
mode: 0
overrideLook: 1
colorAdditive: {r: 0.3, g: 1.4, b: 0.6, a: 1}
colorAlpha: {r: 0.15, g: 0.95, b: 0.45, a: 1}
colorAdditive: {r: 0.25, g: 1.5, b: 0.35, a: 1}
colorAlpha: {r: 0.12, g: 0.95, b: 0.2, a: 1}
widthScale: 1
overrideWeaponSlots: 0
weaponSlotIndices: