Repository navigation
feat(locker): in-app 3D hero preview (Source 2 materials, cloth, R3F) - #1
Closed
oldreceipt wants to merge 4 commits into
Closed
oldreceipt wants to merge 4 commits into
oldreceipt wants to merge 4 commits into
Conversation
oldreceipt
force-pushed
the
feat/r3f-viewer-integration
branch
from
June 20, 2026 16:48
0ccb17a to
1f1fa6b
Compare
Add the React Three Fiber stack used by the in-app 3D hero preview: drei, @react-three/postprocessing + postprocessing, and three-custom-shader-material, plus the gltfjsx and @react-three/test-renderer dev tooling. leva is a devDependency (dev-only viewer controls). Ignore the vpkmerge build output (target/) and the cloth solver visual testbed scratch dir.
…iewEnabled Decode the Source 2 FeModel (m_feModel) cloth block and run a faithful Verlet/XPBD solver on the hero preview skeleton: the feModel parser, clothMath fit helpers, and the useClothSim hook. Covered by unit, harness, and a rest-pose-oracle regression against a real hero fixture. Off by default behind the clothPreviewEnabled feature flag.
Reconstruct Deadlock's pbr.vfx NPR look (cel, rim, tint, self-illum, detail, outline) via a single-pass unified material builder (deadlockMaterial), a no-eval Tier-1 dynamic-scalar evaluator (dynamicScalar), and the layered source2NprMaterial path; add selective bloom (self-illum + metallic) and the ambient-FX sprite descriptor. Each piece is unit-tested.
Add the React Three Fiber hero preview (HeroPoseViewer) and its GLB loader, wired end to end through the main-process model/effect export, IPC, preload, and renderer API. Surfaces the Source 2 material payload baked onto the GLB plus the optional cloth, bloom, and ambient-FX layers, with a hold-to-pause turntable. Render-feature resolution lives in a sibling heroPoseRenderFeatures module. Includes the data-flow design doc, removes two stale handoff/backlog docs from the prior phase, updates CLAUDE.md for the new vitest suite, and adds the preview i18n strings.
oldreceipt
force-pushed
the
feat/r3f-viewer-integration
branch
from
June 20, 2026 17:19
1f1fa6b to
5222665
Compare
Owner
Author
|
Superseded by Slush97#235 (cleaned history + proper description). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This brings the Locker's 3D hero preview up to in-game fidelity. The existing preview loaded the posed GLB as flat meshes and discarded the Source 2 material data baked onto it; this PR threads that data end to end (main-process export, IPC, preload, renderer API) and reconstructs Deadlock's NPR look (cel shading, rim light, tint, self-illum, detail, outline) on a single unified material build pass, layered over the IBL + ACES output rather than replacing it. It adds selective bloom for self-illum glows, an ambient-FX sprite descriptor path, and a faithful Source 2 FeModel cloth solver. Selective bloom ships on by default; the heavier NPR/cloth/effect work is wired and tested but parked behind dev flags while it is calibrated.
What's included
Renderer (3D preview)
HeroPoseViewerrebuilt on React Three Fiber: surfaces the Source 2 material payload on the posed GLB, holds a slow turntable with a hold-to-pause control, and exposes dev-only Leva controls for the render flags.deadlockMaterial: a single-pass unified material builder that clones each GLTF material into one we own (the GLTF base is never mutated) and decides all Source 2 state (glass / translucent / additive / self-illum / sheen / unlit / jitter) plus the cel + rim + tint + self-illum-scroll GLSL in one wrap.source2NprMaterial: the layered NPR reconstruction path and shared material helpers.dynamicScalar: a no-eval Tier-1 dynamic-scalar evaluator for Source 2 dynamic material expressions.BloomEffect: selective bloom over self-illum + metallic, thresholded in linear space.ParticleEffect+fxDescriptor: the ambient-FX sprite descriptor consumer.Cloth simulation (parked behind a flag)
feModel: TS parser for the Source 2 FeModel (PHYS.m_pFeModel) block, mirroring morphic'sdecode_fe_model.clothMath+useClothSim: Verlet/XPBD solver fit to the hero preview skeleton.clothPreviewEnabledflag.Plumbing
heroPoseModels.ts(cloth model + ambient FX export), new IPC handlers inipc/portraits.ts, preload bridge methods, and renderer API wrappers inlib/api.ts(withHeroEffectInfo/ClothModeltypes).heroPoseRenderFeaturessibling module.pose.pauseSpin/pose.resumeSpin).Tests and docs
docs/3d-preview-effects-feasibility.md) anddocs/hero-pose-locker.md; removes two stale handoff/backlog docs from the prior phase.Notes for reviewers
USE_NPR_PREVIEW), NPR outline, broad Source 2 shader hints, rigged/animated preview (USE_RIGGED_PREVIEW), and cloth (USE_CLOTH). What is actually live by default is the unified material build pass, cel-v2, and selective bloom. The dormant paths are fully wired and tested so they can be flipped on per material/hero as they are calibrated; flags can be toggled at runtime vialocalStoragefor dev iteration.model femodel, the FX descriptor export,--pose).feModel.tsis the TS mirror of morphic'sdecode_fe_model, and the cloth rest-pose semantics are validated against morphic's Rust rest oracle. The bundled version is pinned inscripts/fetch-vpkmerge.mjs. If the cloth/FX wire shape changes on the morphic side,feModel.tsandfxDescriptor.tsmust move with it.@react-three/drei,@react-three/postprocessing+postprocessing,three-custom-shader-material. Dev-only:@react-three/test-renderer(for the viewer tests),gltfjsx, andleva(the dev-only viewer controls).three/@react-three/fiberwere already present..gitignore. Ignores the vpkmergetarget/build output and the local.cloth-testbed/solver scratch dir; neither is meant to be committed.docs/3d-preview-effects-feasibility.mdis the grounding for the FX axis (renderer-class tiers, the curated ambient roster, and why the raw "ambient candidate" metric over-counts). It is the reference for the dormant effect path, not a claim that the path ships on.Testing
The full build (
pnpm build) needsGRIMOIRE_SOCIAL_BASE_URLset (consumed byelectron.vite.config.ts); the lint and Vitest suite above do not require it.