Skip to content

Load Dark Cloud's models from glTF, and add Enhanced cloth - #234

Merged
Adubbz merged 2 commits into
TheMoonPeople:masterfrom
SirFancyBacon:model-framework
Oct 27, 2026
Merged

Adubbz merged 2 commits into
TheMoonPeople:masterfrom
SirFancyBacon:model-framework

Conversation

@SirFancyBacon

Copy link
Copy Markdown
Contributor

Summary

Dark Cloud's models, motions, skin weights and bind poses are converted to glTF 2.0 at extraction, through Kazarov's model converter as Dark Cloud 2's are, and the game loads them from there. Cloth gets an optional Enhanced mode that keeps it out of the body. The design, the measurements and what is left for later are in docs/MODEL_FRAMEWORK.md.

Depends on the Kazarov pull request from SirFancyBacon:chronicle-models-on-master (a game profile for the model converter). The submodule pins that branch's head, two commits on top of the current pin.

Models

  • Extraction. dcdata extract converts the models with the textures. convert-models writes a conversion to a folder of its own, bake-assets publishes one into extracted data, and strip-models empties the converted originals. The character configuration (.cfg, .clo) is read word for word as the game reads it (tools/dcdata/character_profile.hpp) and handed to Kazarov as a profile reader. Each KEY becomes a named glTF action that keeps its source frames, because Dark Cloud's hit windows compare absolute motion frames. Dark Cloud adds 2,293 names to Kazarov's motion name table.
  • Loading. The game's loaders stay as they are. As DataReadLoadFile reads a file, port/src/data/model_gltf.cpp rebuilds every published source inside it (pack members, nested packs, scenes at offsets) and writes it where the disc has it.
  • Parity. Models, weights, bind poses and motions come back byte for byte. A source goes in only over the bytes it was converted from, and only if it matches their CRC-32; otherwise the file keeps what it read. Stripped data refuses to start, with a message to rebake, rather than hand the game zeros.
  • On the PAL disc, 11,949 sources convert in about four and a half minutes.

Enhanced cloth

Display → Cloth: Original (the default) or Enhanced (video.cloth). Enhanced runs the PS2's step unchanged, then pushes the cloth out of the body the way the step pushes it out of the .clo boxes:

  • Arms and legs: a capsule along each joint. Each point keeps the clearance it had when the cloth settled, so cloth authored against an arm stays there, while an arm raised through it pushes it.
  • Chest and pelvis: fitted to the character's skinned mesh when the cloth settles, so Toan's deep chest and shallow back are both right.
    • Cloth authored inside the chest, like Toan's collar, goes no deeper than it rests.
    • A limb pressing cloth towards the torso stops it at the surface.

Measured against Original in scripted headless runs:

  • Running and turning give the same tick-to-tick motion, neck stretch and hem.
  • A quick about-turn swings the poncho round Toan's chest instead of through it.
  • In the attract movie, the deepest overlap of his arms and the poncho falls from 0.74 to 0.34.

The clipping left in the attract movie is retail's: the collar is authored inside his chest, and Original shows the same.

Testing

  • Unit tests:
    • CharacterProfile.*, on fixtures made in code.
    • ClothEnhanced.*, 14 cases on synthetic skeletons and meshes.
    • ModelGltf.*, opt-in through DC_MODEL_DATA, DC_MODEL_RAW and DC_MODEL_STRIPPED, sharded with DC_MODEL_PART.
  • Whole PAL disc:
    • Every model, weight, bind pose and motion rebuilds byte for byte.
    • Every motion keeps its poses in every action.
    • Every motion spliced into its pack matches the disc.
    • Stripped data reads back as the disc's.
  • Full suite on lavapipe in the Flatpak SDK: 704 of 709 pass. The five failures are all in Kazarov's graphics tests, which this PR doesn't change:
    • the two GfxValidation cases, because the SDK has no validation layer;
    • GfxMisc.PipelineCache;
    • the two GfxGpuColorWriteMask cases.
  • Headless runs of the attract movie (Original and Enhanced) and Norune, from glTF.
  • In play: Norune and the attract movie, with both cloth modes.
  • Not tested:
    • the NTSC disc;
    • Windows, macOS and Switch builds.

Phases 1 to 3 of docs/MODEL_FRAMEWORK.md.

Extraction: dcdata reads Dark Cloud's .cfg and .clo files word for word as
ReadInfo, CTextureAnime::LoadCFGFile and InitCloth do
(tools/dcdata/character_profile.hpp), taking a KEY's name from the comment on its
line, and hands them to Kazarov's converter, which publishes every model, motion,
skin weight and bind pose as glTF with a sidecar and indexes them in
data/models.json. extract and the new bake-assets command convert the textures
and models together; convert-models writes the conversion to a folder of its
own, and strip-models empties the converted sources in the data in place.

Loading: the game's loaders are unchanged. As DataReadLoadFile reads a file,
data/model_gltf.cpp rebuilds each published source inside it, pack members and
scenes at offsets alike, and writes it where the disc has it. Models, weights,
bind poses and motions come back byte for byte. A motion keeps the disc's key
frames and channel order, since the game reads every vertex channel of a frame
at the first one's key. A source is written only over the bytes it was
converted from or the zeros stripping left, and only if it matches their CRC;
a failure leaves the file as read, except on stripped data, which stops with a
message to rebake.

Tests: the configuration reader, on fixtures made in code. On the PAL disc
(DC_MODEL_DATA, DC_MODEL_RAW, DC_MODEL_STRIPPED, split across processes with
DC_MODEL_PART): every model, weight, bind pose and motion rebuilds byte for
byte, every motion keeps its poses in every action, every motion spliced into
its pack matches the disc, and stripped data reads back as the disc's.

Pins Kazarov to its Dark Cloud model profile (models_convert_dc1).
Phase 4 of docs/MODEL_FRAMEWORK.md. Cloth gets an Original/Enhanced choice on
the Display page (video.cloth, Original by default). Enhanced keeps the PS2's
step as it is, so the cloth moves as it always has, then pushes the free
vertices out of the body the way the step pushes them out of the .clo boxes.
The body is the skeleton as capsules:

- Arms and legs: a capsule along each joint. Each vertex keeps the clearance
  from each limb it had when the cloth settled, so cloth authored against an
  arm stays there, and an arm raised through where it rests pushes it.
- Chest and pelvis: fitted, when the cloth settles, to the character's drawn
  skinned mesh, measured from the spine in 12 directions at 6 heights in the
  spine joint's frame. Each vertex of the mesh goes to the capsule it lies
  nearest, head, hands and feet among them, so a hand at the side doesn't
  widen the torso. Cloth authored resting inside the torso (Toan's collar)
  goes no deeper than it rests.
- A limb pressing cloth towards the torso stops it at the torso's surface, or
  where it rests if that is nearer.

Measured against Original in scripted headless runs: the same tick-to-tick
motion, neck stretch and hem; a quick about-turn swings Toan's poncho round
his chest rather than through it; the back panel hangs as Original's and never
goes into his back; the deepest overlap of his arms and the poncho in the
attract movie falls from 0.74 to 0.34. A full position-based solver was tried
first and dropped: the cloth is authored for the PS2's soft springs, and it
rode up or stiffened.

The remaining clipping in the attract movie is the PS2's own, and Original's
is the same: the collar is authored up to 0.8 inside Toan's chest, and in the
movie's raised-arm poses the skinned chest and shoulders swell over it.
@Adubbz
Adubbz merged commit 0150d6c into TheMoonPeople:master Oct 27, 2026
6 of 7 checks passed
Adubbz added a commit that referenced this pull request Oct 28, 2026
BtbN prunes its dated autobuilds, so the pinned FFmpeg archive stopped downloading
and the Windows job failed while installing its dependencies. Kazarov now
cross-compiles its LGPL kz-ffmpeg configuration for Windows and publishes it, with
cxxbridge, in its deps release; acquire.ps1 and acquire-rust.ps1 download both
from there instead of BtbN and a personal fork, and nothing is built from source.

Updates Kazarov to master, which merges the Dark Cloud model profile that #234
pinned from its pull request and adds the Windows FFmpeg build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants