Skip to content

fix(mhfu-port): a ported PMO's clip is its largest scale component - #61

Merged
sp00ktober merged 1 commit into
mainfrom
fix/pmo-clip
Oct 9, 2026
Merged

sp00ktober merged 1 commit into
mainfrom
fix/pmo-clip

Conversation

@sp00ktober

Copy link
Copy Markdown
Contributor

A ported monster no longer vanishes while it is still on screen.

  • The cull: the engine tests a sphere against the view frustum.
    • Its radius is max(ENTITY.RENDER_SCALE) × PMO.clip, the PMO header at +0x0C.
    • Its centre sits half a scale.y above the entity's position.
    • Every MHFU model sets clip to its largest scale component.
  • The bug: mhfu-port wrote 0, so a port was culled as a point just above its feet. Near the camera, the whole model vanished while its back was still in frame.
  • The fix: mesh.build writes max(scale), which is 608.34 for the Zinogre. Only header bytes 0xC–0xF change; the four golden digests are updated for that.

Live in lane 3: a 0.3-size Zinogre NPC at the same pose, moved toward the camera.

  • clip 0: culled from 140 xz / 299 3D units from the eye;
  • clip 608: drawn down to 20 xz / 234 3D, by which point it has left the frame.

This applies to quest ports too. A port picks it up when it is re-injected (mhfu-port inject).

Tests: mhfu-port, mhp-formats and studio pass with both games' data, and pre-commit is clean.

🤖 Generated with Claude Code

…s MHFU's are

The converter wrote 0, so the engine's sphere-frustum cull treated a port as a
point just above its feet: the model vanished as soon as that point left the
view, near the camera most of all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sp00ktober
sp00ktober merged commit b47d79e into main Oct 9, 2026
5 checks passed
@sp00ktober
sp00ktober deleted the fix/pmo-clip branch October 9, 2026 09:26
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.

1 participant