3D 리플레이 실감 2단계: 게임 스킬 효과 추출(Abilities.cs: Cascade 파티클 · 메시 · 텍스처 → abilities.json) · 사이트 파티클 재생기(lib/vfx.ts: 시간만으로 계산 · 연막 돔 · 장판 칸 · 투사체 꼬리 · 설치물 메시) · maps3d json/png 제공 · update.sh/pack.py 연결
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,20 @@
|
||||
- 재생기: 카메라 위에서 / 1인칭(고른 선수 눈 + 60cm, pitch) / 자유시점(WASD · Q/E · Shift, 끌어서 둘러보기). 요원은 이동 방향 · 속도로 아래 몸 애니메이션을 섞는다. 스킬은 `lib/abilities.ts` 가 클래스 이름으로 연막(요원 색 구) · 장판 · 폭발 · 정찰 고리 · 설치물 · 스파이크로 나눈다.
|
||||
- 한계: 스킬 효과(파티클) · 벽 스킬 방향 · 앉기 · 점프 자세 · 스킨은 없다. 리플레이 위치는 10Hz 라 빠른 움직임은 보간이다.
|
||||
|
||||
## 스킬 효과 (2026-10-18, 실감 2단계)
|
||||
- 추출: `gvr-map-extract abilities <폴더>` (`src/Abilities.cs`) → `abilities.json` + `m_*.glb`(스킬 · 투사체 · 설치물 메시, 파티클 메시) + `t_*.png`(256px, 큰 것 512px). 13.08 전체: 스킬 클래스 217 · 파티클 시스템 520 · 메시 373 · 텍스처 1054, 받은 양 341MB · 3.9분 · 최대 메모리 1.7GB, gzip 합계 약 40MB (json 0.8MB).
|
||||
- 발로란트 효과는 전부 Cascade `ParticleSystem` 이다 (Niagara 0개). 이미터마다 모양(sprite · mesh · decal · ribbon) · 재질 · 분포 표(구운 FRawDistribution) 를 그대로 옮긴다. 형식 설명은 `Abilities.cs` 머리말.
|
||||
- 클래스(리플레이 objectKinds) → 블루프린트 → FXC 효과 묶음 · 패치 · 투사체 컴포넌트에서 역할(loop · intro · outro · warn · trail · explode · patch · decal) 별 시스템(아군 · 적 따로).
|
||||
- `update.sh` 가 맵 · 요원 · 애니메이션 다음에 돌리고 `pack.py` 가 `abilities/` 를 gzip 해 index.json `abilities` 로 올린다.
|
||||
- 사이트 `lib/vfx.ts`: 입자 상태를 "켜진 뒤 지난 시간" 만으로 계산 (입자마다 고정 난수) → 되감기 · 배속에도 같은 장면. 이미터 종류별로 인스턴스 사각형 · 인스턴스 메시 · 바닥에 눕힌 사각형 · 지나간 길(리본).
|
||||
- 재질 그래프는 쿡된 파일에 없다(매개변수 · 텍스처만). 이름 점수로 색 · 알파 텍스처를 고르고, 텍스처 채널 상관으로 색 그림 · 흑백/묶음 마스크(R)를 가린다. UE 반투명처럼 (HDR 색 × 불투명도) 를 미리 곱한 알파로 더하고 채널마다 0.8 위를 눌러 불꽃이 주황 · 노랑이 된다.
|
||||
- 연막 돔(불투명 · 마스크 큰 구)은 요원별 색(`DOME`) + noise + 가장자리 빛(게임 팀 색). 돔 위 반투명 층은 돔 색으로 옅게.
|
||||
- 장판(CellularPatch): 게임처럼 반지름 안 칸마다 불 효과 하나, 가운데서 SpreadSpeed 로 번진다. 그을음은 반지름 크기.
|
||||
- 뺀 것: 벽 너머 표시 · HUD · 1인칭 · 사거리 표시 · 팀 구별 층(FoF) · beam · 화면 아이콘 메시. 데이터가 예상과 다른 이미터는 그 이미터만 끈다.
|
||||
- 효과가 없는 클래스는 예전 종류별 모양, 날아가는 모습이 없는 투사체(요루 섬광 등)는 예전 빛 구 + 터지는 효과. 요루 분신 · 스파이크는 원래 그리던 것 + 효과.
|
||||
- 개발 확인: 효과 하나만 따로 그리는 판(`~/.tmp/gvr/vfxHarness.ts` 를 `site/web/src/dev/` 에 잠시 두고 vite dev 에서 `import('/src/dev/vfxHarness.ts')`). 저장소에는 넣지 않았다.
|
||||
- 한계: 재질 그래프 근사라 색 · 무늬가 게임과 조금 다르다. 리본 · beam 일부, 화면 효과(섬광 눈부심 등)는 없다. 오멘 연막처럼 추출기가 클래스를 못 찾은 것은 예전 모양.
|
||||
|
||||
## 남은 일
|
||||
- 실제 경기로 동기화 오차 확인 (사이트 아래 줄 "킬 N개로 맞춤 (최대 오차 X초)")
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
||||
*
|
||||
* <dataDir>/maps3d/index.json {version, dir, updatedAt, maps:{<맵 경로>:{code,file,bytes,triangles}}}
|
||||
* <dataDir>/maps3d/<dir>/<code>.glb.gz meshopt 압축 glb 를 gzip 한 것. 위치는 UE 월드 좌표(cm)
|
||||
* <dataDir>/maps3d/<dir>/abilities.json.gz · m_*.glb.gz · t_*.png.gz 스킬 목록 · 모델 · 텍스처 (모두 gzip)
|
||||
*
|
||||
* GET /site/maps3d → index.json (없으면 {maps:{}})
|
||||
* GET /site/maps3d/:dir/:f → glb (content-encoding gzip). 폴더 이름이 패치마다 바뀌므로 오래 캐시한다
|
||||
* GET /site/maps3d/:dir/:f → glb · json · png · jpg (content-encoding gzip). 폴더 이름이 패치마다 바뀌므로 오래 캐시한다
|
||||
*/
|
||||
export interface Maps3dIndex {
|
||||
version: string;
|
||||
@@ -20,6 +21,9 @@ export interface Maps3dIndex {
|
||||
maps: Record<string, { code: string; file: string; bytes: number; triangles: number }>;
|
||||
}
|
||||
|
||||
/** 보내는 파일 종류: 3D (맵 · 요원 · 무기 · 스킬 모델 · 공용 애니메이션) · 스킬 목록 · 스킬 텍스처 */
|
||||
const TYPES: Record<string, string> = { '.glb': 'model/gltf-binary', '.json': 'application/json', '.png': 'image/png', '.jpg': 'image/jpeg' };
|
||||
|
||||
export function registerMaps3d(app: FastifyInstance, dataDir: string, requireSession: (req: FastifyRequest, reply: FastifyReply) => Promise<unknown>) {
|
||||
const root = path.join(dataDir, 'maps3d');
|
||||
let cache: { mtime: number; data: Maps3dIndex | null } = { mtime: -1, data: null };
|
||||
@@ -50,10 +54,11 @@ export function registerMaps3d(app: FastifyInstance, dataDir: string, requireSes
|
||||
app.get<{ Params: { dir: string; file: string } }>('/site/maps3d/:dir/:file', async (req, reply) => {
|
||||
if (!(await requireSession(req, reply))) return;
|
||||
const { dir, file } = req.params;
|
||||
if (!/^[\w.-]+$/.test(dir) || !/^[\w.-]+\.glb$/.test(file) || dir.includes('..')) return reply.code(404).send({ error: 'not_found' });
|
||||
const type = TYPES[path.extname(file).toLowerCase()];
|
||||
if (!/^[\w.-]+$/.test(dir) || !/^[\w.-]+$/.test(file) || !type || dir.includes('..')) return reply.code(404).send({ error: 'not_found' });
|
||||
const gz = path.join(root, dir, file + '.gz');
|
||||
if (!fs.existsSync(gz)) return reply.code(404).send({ error: 'not_found' });
|
||||
reply.header('cache-control', 'private, max-age=31536000, immutable').type('model/gltf-binary');
|
||||
reply.header('cache-control', 'private, max-age=31536000, immutable').type(type);
|
||||
if (/\bgzip\b/.test(String(req.headers['accept-encoding'] ?? ''))) {
|
||||
reply.header('content-encoding', 'gzip').header('content-length', fs.statSync(gz).size);
|
||||
return reply.send(fs.createReadStream(gz));
|
||||
|
||||
@@ -38,6 +38,9 @@ async function stack() {
|
||||
const dir = path.join(cfg.dataDir, 'maps3d', 'V1-1');
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, 'Ascent.glb.gz'), zlib.gzipSync(Buffer.from('glTF-test')));
|
||||
fs.writeFileSync(path.join(dir, 'abilities.json.gz'), zlib.gzipSync(Buffer.from('{"classes":{}}')));
|
||||
fs.writeFileSync(path.join(dir, 't_Smoke.png.gz'), zlib.gzipSync(Buffer.from('png-test')));
|
||||
fs.writeFileSync(path.join(dir, 'secret.txt.gz'), zlib.gzipSync(Buffer.from('no')));
|
||||
fs.writeFileSync(path.join(cfg.dataDir, 'maps3d', 'index.json'), JSON.stringify({ version: 'V1', dir: 'V1-1', updatedAt: 'x', maps: { '/Game/Maps/Ascent/Ascent': { code: 'Ascent', file: 'Ascent.glb', bytes: 1, triangles: 1 } } }));
|
||||
const { app, store } = await buildServer(cfg);
|
||||
await app.listen({ host: '127.0.0.1', port: 0 });
|
||||
@@ -72,6 +75,16 @@ test('맵 3D: 로그인하면 목록과 glb 를 받는다 (gzip), 이상한 경
|
||||
assert.equal(r.status, 200);
|
||||
assert.equal(r.headers.get('content-encoding'), 'gzip');
|
||||
assert.equal(await r.text(), 'glTF-test'); // fetch 가 gzip 을 풀어 준다
|
||||
// 스킬 목록 · 텍스처도 같은 폴더에서 (gzip, 종류에 맞는 content-type)
|
||||
const j = await fetch(s.base + '/site/maps3d/V1-1/abilities.json', { headers: { cookie, 'accept-encoding': 'gzip' } });
|
||||
assert.equal(j.status, 200);
|
||||
assert.match(j.headers.get('content-type') ?? '', /application\/json/);
|
||||
assert.deepEqual(await j.json(), { classes: {} });
|
||||
const t = await fetch(s.base + '/site/maps3d/V1-1/t_Smoke.png', { headers: { cookie, 'accept-encoding': 'gzip' } });
|
||||
assert.equal(t.status, 200);
|
||||
assert.equal(t.headers.get('content-type'), 'image/png');
|
||||
// 정해진 종류(glb · json · png · jpg)가 아니면 404
|
||||
assert.equal((await fetch(s.base + '/site/maps3d/V1-1/secret.txt', { headers: { cookie } })).status, 404);
|
||||
assert.equal((await fetch(s.base + '/site/maps3d/V1-1/..%2Findex.json', { headers: { cookie } })).status, 404);
|
||||
assert.equal((await fetch(s.base + '/site/maps3d/V1-1/Nope.glb', { headers: { cookie } })).status, 404);
|
||||
} finally {
|
||||
|
||||
@@ -202,8 +202,9 @@ async function handle(req, res) {
|
||||
if (p === '/site/maps3d') return json(res, 200, JSON.parse(fs.readFileSync(path.join(root, 'index.json'), 'utf8')));
|
||||
const [dir, file] = p.slice('/site/maps3d/'.length).split('/').map(decodeURIComponent);
|
||||
const f = path.join(root, dir ?? '', (file ?? '') + '.gz');
|
||||
if (!/^[\w.-]+$/.test(dir ?? '') || !/^[\w.-]+\.glb$/.test(file ?? '') || !fs.existsSync(f)) return json(res, 404, { error: 'not_found' });
|
||||
res.writeHead(200, { 'content-type': 'model/gltf-binary', 'content-encoding': 'gzip', 'content-length': fs.statSync(f).size });
|
||||
const type = { '.glb': 'model/gltf-binary', '.json': 'application/json', '.png': 'image/png', '.jpg': 'image/jpeg' }[path.extname(file ?? '').toLowerCase()];
|
||||
if (!/^[\w.-]+$/.test(dir ?? '') || !/^[\w.-]+$/.test(file ?? '') || !type || !fs.existsSync(f)) return json(res, 404, { error: 'not_found' });
|
||||
res.writeHead(200, { 'content-type': type, 'content-encoding': 'gzip', 'content-length': fs.statSync(f).size });
|
||||
return fs.createReadStream(f).pipe(res);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { findMap3d, loadMap3d, mapMaterial, worldMatrix } from '../lib/map3d';
|
||||
import { AgentRig, isGun, loadAgent, loadAnims, loadWeapon } from '../lib/agents3d';
|
||||
import { buildAnimIndex, rigInput } from '../lib/replayAnim';
|
||||
import { abilityLook, type AbilityLook } from '../lib/abilities';
|
||||
import { loadVfxDb, vfxCoverage, VfxObject, type Place, type VfxDb } from '../lib/vfx';
|
||||
|
||||
/**
|
||||
* 3D 리플레이 (발로란트 .vrf → tools/replay-extract → gvr-replay JSON).
|
||||
@@ -472,6 +473,40 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
|
||||
};
|
||||
// 움직이는 스킬 경로 (투사체 · 드론 · 분신): objects 번호 → 경로
|
||||
const pathOf = new Map((replay.objectPaths ?? []).map((p) => [p.o, p]));
|
||||
// 게임 파일 스킬 효과 (lib/vfx.ts: 메시 · 파티클). 받으면 종류별 모양 대신 쓴다.
|
||||
// 요루 분신 · 스파이크는 지금 그리는 것(요원 몸 애니메이션 · 스파이크 3D)을 두고 효과만 더한다
|
||||
let vfxDb: VfxDb | null = null;
|
||||
let vfxKinds: ('full' | 'partial' | 'none')[] = [];
|
||||
const vfxObjs = new Map<number, VfxObject>();
|
||||
const vfxGroup = new THREE.Group();
|
||||
agentsGroup.add(vfxGroup);
|
||||
void loadVfxDb().then((db) => {
|
||||
if (!db || disposed) return;
|
||||
vfxDb = db;
|
||||
vfxKinds = replay.objectKinds.map((k) => vfxCoverage(db, k));
|
||||
});
|
||||
const KEEP_OWN = /^(Pawn_Stealth_4_Decoy|TimedBomb_C)/;
|
||||
const camUE = new THREE.Vector3();
|
||||
const invAgents = new THREE.Matrix4();
|
||||
const deg = (r: number) => (r * 180) / Math.PI;
|
||||
const placeOf = (i: number) => {
|
||||
const o = replay.objects[i];
|
||||
const path = pathOf.get(i);
|
||||
const still: Place = { x: o[3], y: o[4], z: o[5], yaw: o[7] ?? 0, pitch: 0 };
|
||||
if (!path || path.t.length < 2) return { at: (_t: number) => still, speed: 0 };
|
||||
const n = path.t.length;
|
||||
const dist = path.x.slice(1).reduce((d, x, k) => d + Math.hypot(x - path.x[k], path.y[k + 1] - path.y[k], path.z[k + 1] - path.z[k]), 0);
|
||||
const speed = dist / Math.max(0.05, (path.t[n - 1] - path.t[0]) / 1000);
|
||||
return {
|
||||
speed,
|
||||
at: (tMs: number): Place => {
|
||||
const pp = samplePath(path, Math.max(path.t[0], Math.min(path.t[n - 1], tMs)));
|
||||
if (!pp) return still;
|
||||
const h = Math.hypot(pp.vx, pp.vy);
|
||||
return { x: pp.x, y: pp.y, z: pp.z, yaw: pp.yaw ?? (h > 1 ? deg(Math.atan2(pp.vy, pp.vx)) : still.yaw), pitch: h > 1 || Math.abs(pp.vz) > 1 ? deg(Math.atan2(pp.vz, h)) : 0 };
|
||||
},
|
||||
};
|
||||
};
|
||||
const setOpacity = (ov: ObjView, k: number) => {
|
||||
for (const m of ov.mats) {
|
||||
const base = (m.userData.baseOpacity ??= m.opacity) as number;
|
||||
@@ -722,10 +757,33 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
|
||||
}
|
||||
}
|
||||
// 스킬 · 설치물: 생긴 뒤 사라질 때까지 (모르면 종류별 기본 시간). 날아가는 것은 던진 자리에 잠깐만
|
||||
invAgents.copy(agentsGroup.matrixWorld).invert();
|
||||
camUE.copy(camera.position).applyMatrix4(invAgents);
|
||||
for (let i = 0; i < replay.objects.length; i++) {
|
||||
const [t0, t1, kind] = replay.objects[i];
|
||||
const ov0 = objViews.get(i);
|
||||
const end = ov0 ? ov0.end : t1 >= t0 ? t1 : t0 + abilityLook(replay.objectKinds[kind] ?? '').defaultMs;
|
||||
if (vfxDb && vfxKinds[kind] && vfxKinds[kind] !== 'none') {
|
||||
const cls = replay.objectKinds[kind] ?? '';
|
||||
const own = KEEP_OWN.test(cls) || vfxKinds[kind] === 'partial';
|
||||
let vo = vfxObjs.get(i);
|
||||
const near = t >= t0 - 100 && t <= end + 6000;
|
||||
if (near && !vo) {
|
||||
const pl = placeOf(i);
|
||||
const owner = replay.objects[i][6];
|
||||
vo = new VfxObject(vfxDb, { cls, t0, end, team: roster[owner]?.ally ? 'ally' : 'enemy', projectile: /^Projectile_/.test(cls), placeAt: pl.at, speed: pl.speed }, vfxGroup, i + 1, !own);
|
||||
vfxObjs.set(i, vo);
|
||||
} else if (!near && vo) {
|
||||
vo.dispose();
|
||||
vfxObjs.delete(i);
|
||||
vo = undefined;
|
||||
}
|
||||
vo?.update(t, camUE);
|
||||
if (!own) {
|
||||
if (ov0) ov0.obj.visible = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const on = t >= t0 && t <= end;
|
||||
if (!on) {
|
||||
if (ov0) {
|
||||
@@ -829,6 +887,7 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
|
||||
renderer.domElement.removeEventListener('blur', onBlur);
|
||||
controls.dispose();
|
||||
for (const v of views) v.rig?.dispose();
|
||||
for (const vo of vfxObjs.values()) vo.dispose();
|
||||
scene.traverse((o) => {
|
||||
const mesh = o as THREE.Mesh;
|
||||
mesh.geometry?.dispose?.();
|
||||
|
||||
1824
site/web/src/lib/vfx.ts
Normal file
1824
site/web/src/lib/vfx.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
"""gvr-map-extract 결과(<코드>.glb + <코드>.json)를 사이트용으로 압축한다.
|
||||
pack.py <추출 폴더> <출력 폴더> <버전(예: VALORANT_13.08)>
|
||||
(agents.json 이 있으면 요원 agent_*.glb · 무기 weapon_*.glb 도 같은 폴더에, index.json agents · weapons.
|
||||
anims.glb 가 있으면 공용 애니메이션 index.json anims)
|
||||
anims.glb 가 있으면 공용 애니메이션 index.json anims, abilities/abilities.json 이 있으면 스킬 재료 index.json abilities)
|
||||
출력: <출력>/<dir>/<코드>.glb.gz (gltfpack -cc 로 meshopt 압축 · 위치 양자화 → gzip) + <출력>/index.json
|
||||
-ke: 재질 extras(두 층 섞기 B 층) 유지, -vt 14: 반복 UV 가 뭉개지지 않게
|
||||
사이트 서버 data/maps3d 에 그대로 올리면 된다 (site/server/src/maps3d.ts)."""
|
||||
@@ -59,7 +59,21 @@ if os.path.exists(os.path.join(src, 'anims.glb')):
|
||||
size = pack_one('anims.glb')
|
||||
anims = {'file': 'anims.glb', 'bytes': size}
|
||||
print(f'공용 애니메이션 {size / 1e6:.1f}MB')
|
||||
idx = {'version': version, 'dir': d, 'updatedAt': datetime.datetime.now(datetime.timezone.utc).isoformat(), 'maps': maps, 'agents': agents, 'weapons': weapons, 'anims': anims}
|
||||
# 스킬 재료 (abilities 명령 결과 abilities/ 폴더): abilities.json · m_*.glb · t_*.png 를 gzip 만 한다
|
||||
# (메시는 작고 뼈대 · 텍스처가 든 것도 있어 gltfpack 을 거치지 않는다)
|
||||
abilities = None
|
||||
ad = os.path.join(src, 'abilities')
|
||||
if os.path.exists(os.path.join(ad, 'abilities.json')):
|
||||
total = 0
|
||||
for f in sorted(os.listdir(ad)):
|
||||
if not (f == 'abilities.json' or (f.startswith(('m_', 't_')) and f.endswith(('.glb', '.png')))):
|
||||
continue
|
||||
with open(os.path.join(ad, f), 'rb') as fi, gzip.open(os.path.join(out, d, f + '.gz'), 'wb', 9) as g:
|
||||
shutil.copyfileobj(fi, g)
|
||||
total += os.path.getsize(os.path.join(out, d, f + '.gz'))
|
||||
abilities = {'file': 'abilities.json', 'bytes': os.path.getsize(os.path.join(out, d, 'abilities.json.gz'))}
|
||||
print(f'스킬 재료 {total / 1e6:.1f}MB')
|
||||
idx = {'version': version, 'dir': d, 'updatedAt': datetime.datetime.now(datetime.timezone.utc).isoformat(), 'maps': maps, 'agents': agents, 'weapons': weapons, 'anims': anims, 'abilities': abilities}
|
||||
tmp = os.path.join(out, 'index.json.tmp')
|
||||
json.dump(idx, open(tmp, 'w'), ensure_ascii=False, indent=1)
|
||||
os.replace(tmp, os.path.join(out, 'index.json'))
|
||||
|
||||
@@ -126,6 +126,8 @@ GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" extract "$raw"
|
||||
stage="요원 추출"
|
||||
GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" agents "$raw"
|
||||
GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" anims "$raw"
|
||||
# 스킬 재료 (메시 · 파티클 · 텍스처, 사이트가 스킬 효과를 그린다)
|
||||
GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" abilities "$raw/abilities"
|
||||
stage="압축"
|
||||
python3 "$GVR_MAPS_HOME/scripts/pack.py" "$raw" "$out" "$version"
|
||||
dir="$(jq -r .dir "$out/index.json")"
|
||||
|
||||
1547
tools/map-extract/src/Abilities.cs
Normal file
1547
tools/map-extract/src/Abilities.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,11 +11,15 @@ public sealed class MatParams
|
||||
public readonly Dictionary<string, string> Textures = new(StringComparer.OrdinalIgnoreCase);
|
||||
public readonly Dictionary<string, FLinearColor> Vectors = new(StringComparer.OrdinalIgnoreCase);
|
||||
public readonly Dictionary<string, float> Scalars = new(StringComparer.OrdinalIgnoreCase);
|
||||
public readonly Dictionary<string, bool> Switches = new(StringComparer.OrdinalIgnoreCase);
|
||||
public string? BlendMode;
|
||||
public bool TwoSided;
|
||||
public string? ShadingModel;
|
||||
|
||||
public static MatParams Resolve(UMaterialInterface mat)
|
||||
{
|
||||
var r = new MatParams { Path = mat.GetPathName() };
|
||||
bool? twoSided = null;
|
||||
UMaterialInterface? cur = mat;
|
||||
for (var d = 0; d < 12 && cur != null; d++)
|
||||
{
|
||||
@@ -28,8 +32,17 @@ public sealed class MatParams
|
||||
if (v.ParameterValue is { } c && !r.Vectors.ContainsKey(v.Name)) r.Vectors[v.Name] = c;
|
||||
foreach (var s in mi.ScalarParameterValues)
|
||||
if (!r.Scalars.ContainsKey(s.Name)) r.Scalars[s.Name] = s.ParameterValue;
|
||||
if (r.BlendMode == null && mi.TryGetValue(out CUE4Parse.UE4.Assets.Objects.FStructFallback bpo, "BasePropertyOverrides") && bpo.TryGetValue(out bool ov, "bOverride_BlendMode") && ov)
|
||||
r.BlendMode = bpo.GetOrDefault<EBlendMode>("BlendMode").ToString();
|
||||
if (mi.TryGetValue(out CUE4Parse.UE4.Assets.Objects.FStructFallback bpo, "BasePropertyOverrides"))
|
||||
{
|
||||
if (r.BlendMode == null && bpo.TryGetValue(out bool ov, "bOverride_BlendMode") && ov)
|
||||
r.BlendMode = bpo.GetOrDefault<EBlendMode>("BlendMode").ToString();
|
||||
if (twoSided == null && bpo.TryGetValue(out bool ots, "bOverride_TwoSided") && ots)
|
||||
twoSided = bpo.GetOrDefault<bool>("TwoSided");
|
||||
}
|
||||
// 정적 스위치 (StaticParameters): 덮어쓴 것만, 자식 값이 먼저
|
||||
if (mi.StaticParameters?.StaticSwitchParameters is { } sws)
|
||||
foreach (var sp in sws)
|
||||
if (sp.bOverride && !r.Switches.ContainsKey(sp.Name)) r.Switches[sp.Name] = sp.Value;
|
||||
UMaterialInterface? parent = null;
|
||||
try { parent = mi.Parent?.Load<UMaterialInterface>(); } catch { }
|
||||
cur = parent;
|
||||
@@ -37,10 +50,16 @@ public sealed class MatParams
|
||||
else
|
||||
{
|
||||
r.Base = cur.GetPathName();
|
||||
if (r.BlendMode == null && cur is UMaterial m) r.BlendMode = m.BlendMode.ToString();
|
||||
if (cur is UMaterial m)
|
||||
{
|
||||
r.BlendMode ??= m.BlendMode.ToString();
|
||||
twoSided ??= m.TwoSided;
|
||||
r.ShadingModel = m.ShadingModel.ToString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
r.TwoSided = twoSided ?? false;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ using GvrMapExtract;
|
||||
// gvr-map-extract extract <출력 폴더> [맵...] 맵마다 <코드>.glb (UE 월드 좌표 cm, 위치 + 삼각형) + <코드>.json
|
||||
// gvr-map-extract agents <출력 폴더> [요원...] 요원 몸 agent_<코드>.glb · 무기 weapon_<이름>.glb + agents.json
|
||||
// gvr-map-extract anims <출력 폴더> 모든 요원 공용 애니메이션 anims.glb
|
||||
// gvr-map-extract abilities <출력 폴더> [요원 · 클래스...] 스킬 재료 abilities.json + m_*.glb + t_*.png
|
||||
//
|
||||
// 환경변수
|
||||
// GVR_USMAP 매핑 파일 (.usmap, 필수: 13.08 부터 패키지에 형 정보가 없다). uedb.dev 에서 받는다
|
||||
@@ -178,6 +179,9 @@ switch (args[0])
|
||||
Console.WriteLine($"끝: 공용 애니메이션 {r.Clips} · 실패 {r.Failed}{(r.Missing.Count > 0 ? " · 빠짐 " + string.Join(',', r.Missing) : "")} · 받은 양 {store.DownloadedBytes >> 20}MB · {sw.Elapsed.TotalMinutes:F1}분");
|
||||
return r.Failed == 0 ? 0 : 1;
|
||||
}
|
||||
case "abilities":
|
||||
// 요원 스킬 3D 재료: abilities.json + m_*.glb + t_*.png (Abilities.cs)
|
||||
return Abilities.Run(provider, args[1], args.Skip(2).ToList(), store);
|
||||
case "anim":
|
||||
foreach (var a in args.Skip(1)) ProbeAnim.Anim(provider, a);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user