Skip to content

Stretch the models kept in front of the camera with a wider view - #213

Open
nicoNaeg wants to merge 1 commit into
TheMoonPeople:masterfrom
nicoNaeg:fix/flashback-frame-wide
Open

nicoNaeg wants to merge 1 commit into
TheMoonPeople:masterfrom
nicoNaeg:fix/flashback-frame-wide

Conversation

@nicoNaeg

Copy link
Copy Markdown

Summary

At wide aspects, the glowing frame around a flashback stops short of the window's sides. At 16:9, a strip of the scene shows at each edge, beyond the frame's white outer rim. This is the "Griffon is 10,000 years in the past now..." scene reported in #56.

  • The frame now keeps its share of the view. At 16:9 it is stretched by 4/3 across the screen, so it reaches the window's sides as it reaches the screen's at 4:3.
  • The other flashback frames (kaisou_waku) and the speed lines (shuchusen) are placed the same way, so they get the same treatment.
  • 4:3 is unchanged, both for a 4:3 window and with video.aspect 4:3.

Part of #56.

Cause

  1. Events place these models in front of the camera. They use _CMRS_CHARA_ATTACH (Luau event.keep_character_in_front_of_camera_sequence), and scsCharaAttach (port/src/object/event/sceneseq.cpp) puts the character at a fixed distance along the camera's view every frame. The scripts make 37 such calls:
    • the flashback frames kaisou_waku and e372_waku2, at 600 to 760 units;
    • the speed lines shuchusen, at 60.
  2. Each model faces the camera through a billboard. A full billboard node (null2--ba / null1--ba) turns it to the camera, and it is sized to cover retail's 512x480 screen. In e372, the frame's outer edge sits about 318 logical units either side of the centre; the screen is ±256.
  3. A 16:9 window shows more than that. In Fill mode it shows ±341 units, so the frame ends inside the window: the scene shows at x 0–44 and 1235–1279 of a 1280x720 window. The frame's white outer rim is in view too; at 4:3 it stays off-screen.

Change

  • The flag. mgCFrame has a port-only flag, fills_screen, and scsCharaAttach sets it on the root of the model it places.
  • The stretch. mgCFrame::GetBBoardMatrix (port/src/render/mg_frame.cpp) stretches any billboard under such a root by the visible extent over retail's screen (mgPortVisibleExtent), never below 1:
    • its own x axis by the width ratio (/512);
    • its y axis by the height ratio (/480), so a portrait window heightens it the same way.
  • Unchanged. Billboards in every other model are not stretched. At 4:3 both ratios are 1.
  • Tests. MglibAspect.ScreenFillingBillboard* (port/src/tests/mglib_aspect_test.cpp) covers three window sizes; a billboard without the flag keeps its shape at each:
    • 1280x720: x is stretched by 4/3;
    • 1024x768: unchanged;
    • 800x1200: y is stretched by 2.
  • Docs. docs/PC.md, "Window aspect", gets one bullet.

Testing

Environment: macOS 26.6.2 arm64 (M4 Pro), Homebrew LLVM 23.1.5, MoltenVK 1.4.2, presets macos-arm64 (Debug) and macos-arm64-release. PAL data (data_version 20) for the replays.

Replay (Release): --jump event:13720 --fast-load, which is e372 (Crest's return), with Cross every 50 frames from frame 300. Frames 2950 and 3050 are inside the flashback. Side columns: the share of pixels in the outermost 40 columns on each side where blue exceeds red by more than 40, meaning the frame's glow rather than the red scene.

Check Without change With change
New unit tests 16:9 FAIL (x axis 2.0, expected 2.67), portrait FAIL (y axis 2, expected 4), 4:3 PASS 3/3 PASS
1280x720, frames 2950 / 3050: side columns covered by the frame 32.0% / 23.3% 83.3% / 82.8%
960x720 (4:3), frames 2950 / 3050, compared with the parent commit Identical: 0 pixels differ
MglibAspect.*, MgFrameAsm.*, model and arena suites (sizeof(mgCFrame)), MenuReplay.* with data, Debug 220/220 PASS
Full ctest, Debug 2756/2761 pass. Two timeouts under -j6 (SaveSlotTest.MenuScrollsPastThirteenAndClampsItsVisibleWindow, GfxGpuMeshDc2.FogIsContinuousAcrossSharedClippedEdge) pass when run alone. Three fail when rerun: PcSettingsReplay.pad fails the same way with a build of the parent commit (KeyError: 'present_mode'); GfxMisc.MeshBoundsFollowTheFlagAndAreInvalidatedByUpdates and GfxGpuMeshDc2.FragmentInvocationQueriesPreservePixelsAndWindowOwnership test only the Kazarov renderer, which this change does not touch (not rerun on the parent commit)

"Without change" for the replays used a Release build of the parent commit (bcd1967).

Not covered

  • Other scenes. Only e372 (the reported scene) was replayed.
    • The other flashbacks (e704 to e748) and the speed lines (e5, e110, e250, e532) go through the same command and billboard code.
    • Their scenes did not start from --jump here. The two dungeon jumps stop on a missing mainchr/max.stb, and the two town jumps do not trigger the scene.
  • How the frame widens. The stretch widens the frame's glow bands with the window (by 4/3 at 16:9) instead of moving them apart. The speed lines' fan stretches the same way.
  • Platforms: Windows and Linux were not tested.

Events keep the flashback frames (kaisou_waku, e372_waku2) and the speed
lines (shuchusen) in front of the camera with _CMRS_CHARA_ATTACH. Each
model turns to the camera through a billboard sized to cover retail's
512x480 screen, so at 16:9 the e372 flashback frame ended inside the
window: the scene showed beyond its white rim at both sides (TheMoonPeople#56).

scsCharaAttach now marks the model's root (mgCFrame::fills_screen).
GetBBoardMatrix stretches a billboard under such a root by the visible
extent over retail's screen, never below 1: across by the width ratio
and up by the height ratio. Other billboards, and 4:3, are unchanged.

MglibAspect.ScreenFillingBillboard* check the stretch at 1280x720,
1024x768 and 800x1200, and that a billboard without the mark keeps its
shape.
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