Skip to content

3D view: default tile shapes, walls out of the way; roomcap tour mode - #210

Merged
999sian merged 4 commits into
999sian:masterfrom
HelaFaye:backport/roomcap-tour
Oct 20, 2026
Merged

999sian merged 4 commits into
999sian:masterfrom
HelaFaye:backport/roomcap-tour

Conversation

@HelaFaye

Copy link
Copy Markdown

Changes from the HelaFaye/tmc vr fork that apply to Picori itself. They're in four commits, so any one can be dropped.

1. Room-capture harness: tour mode, clean captures, story progress (port/port_repro_roomcap.c)

All of these are opt-in and driven by environment variables.

  • TMC_ROOMCAP_TOUR=<plan>: one game session warps through every view in a plan (area room x y [layer] per line, room-local pixels). Each view is captured to TMC_ROOMCAP_TOUR_OUT/<line>.png, like the voxel tour in port_repro_npc_talk.c. That's about 3 s per view, against about 7 s when a new game is started for each capture.
    • Each capture is logged with the room, the camera (scroll - origin) and where Link stood.
    • A view is taken only when all of these hold:
      • the warp has landed in the room;
      • the game is in GAMEMAIN_UPDATE;
      • the camera is on Link;
      • Link has control and no message is up;
      • TMC_ROOMCAP_SETTLE frames have passed. 160 outlasts the area-name box.
    • A scene on arrival is advanced with A. One example: warping onto a fairy fountain's Piece of Heart.
    • A view that never arrives is skipped.
    • A scene that never ends exits with code 3 and names the view; TMC_ROOMCAP_TOUR_START resumes after it.
    • TMC_ROOMCAP_TOUR_DEBUG=1 logs the wait each second, plus every NPC's script ROM address. That's how the scene holding the camera below was found.
  • TMC_ROOMCAP_CLEAN: the room alone. It sets the game's own HUD_HIDE_ALL, doesn't draw Link, and advances dialogue with A.
  • TMC_ROOMCAP_PROGRESS=<n> (tour): the new game starts past the prologue with n dungeons cleared, by setting TABIDACHI and LV1..n_CLEAR. It also gives what the game hands out by that point:
    • Each dungeon's element. An area change takes a clear back without it (gameUtils.c). That drops Hyrule Town back to the prologue version, whose intro scene (script_Npc4EIntroTown) then holds the camera.
    • The kinstone bag. Without it the town plays Ezlo's kinstone scene.
  • build.py: GIT_TERMINAL_PROMPT=0 for the per-submodule fetch. A private submodule now fails instead of stopping the build at a Username for github.com prompt.

Tested: built, and a three-view Hyrule Town tour lands on each view with the camera on Link. A full run captured 2,492 views of 539 rooms.

2. Default tile shapes for the 3D view (assets/voxel_shapes.json, build.py)

voxel_shapes.json currently starts empty; players fix misread tiles by hand from F8, one at a time. This ships fixes for 510 tile types in 59 areas, generated from HelaFaye/tmc's tile identification (tools/voxel_shapes.py on the vr branch):

  • prop: bushes, saplings, rocks, pots, stumps, mushrooms, stones, boulders, planters, fences and signposts, where a run of them would otherwise stand up as a block.
  • block: partly solid tiles the collision test leaves flat, such as tree-canopy edges, cliff corners, stone walls, building corners and roofs. Also lone solid tiles that belong to a wall or tree, which would otherwise stand as a card.

What gets written:

  • Only tile types where the view's own guess differs: collision, plus its lone-tile prop cards. So nothing it already does is repeated.
  • Only tile types whose cells agree 80%.
  • Water and holes are left to the view.
  • wall is left out; the loader's default is used.

Same format as SaveShapes(). The file holds tile type numbers and shape names only.

build.py stages it next to the binary. An existing voxel_shapes.json is merged, not replaced: the player's own entries win, tile by tile. Checked with a fresh dist/ and with one holding a hand edit.

3. Walls out of the way (port_voxel.cpp, voxel.vert/.frag)

Room geometry between the camera and an actor thins to a 20% dither around the sight line, so the actor stays in sight. Actors are Link and every ENEMY in the entity lists. Examples are a house front, a cliff, a roof, and, once there are more camera angles, the back of a wall seen from outside.

A pixel thins when all of these hold:

  • it is within 20 px of the line from the camera to the actor (feathered over 14 px), aimed 12 px above the actor's feet;
  • it is in front of the actor;
  • it is above the ground the actor stands on. The floor under Link never thins.

How it works:

  • It's a 4×4 Bayer screen door: each pixel is drawn or dropped, so what's drawn stays opaque and writes depth, with no sorting.
  • Only room geometry (kind 0) is affected. Sprites, the backdrop and the HUD are not.
  • voxel.vert passes the world position. voxel.frag's fadeKeep() reads the camera and up to 16 actors from a fragment uniform (set 3), pushed each frame.
  • The SPIR-V was rebuilt for the voxel shaders only.
  • It can be toggled at F8 > Display > 3D walls out of the way (voxel_wall_fade, on by default).

Tested: it builds with --gpu_renderer=y, but I haven't seen it running; the machine it was written on has no Vulkan display. The same rule runs in the fork's WebGL mesh viewer, where it's covered by tests and was checked from several angles.

port_repro_roomcap.c, new modes (all opt-in, env-driven):

- TMC_ROOMCAP_TOUR=<plan>: one game session warps through every view in
  a plan ("area room x y [layer]" a line, room-local pixels) and captures
  each to TMC_ROOMCAP_TOUR_OUT/<line>.png, as the voxel tour
  (port_repro_npc_talk.c) walks every room: ~3 s a view instead of ~7 s
  for a game started per capture. Each capture is logged with the room,
  the camera (scroll - origin, room pixels) and where Link stood. A view
  is taken only in the room, in GAMEMAIN_UPDATE, with the camera on Link,
  Link in control and no message up, after TMC_ROOMCAP_SETTLE frames (160
  outlasts the area-name box); a scene on arrival (a warp onto a fairy
  fountain's Piece of Heart) is waited out with A. A view that never
  arrives is skipped; a scene that never ends exits (3) naming the view,
  and TMC_ROOMCAP_TOUR_START resumes after it. TMC_ROOMCAP_TOUR_DEBUG=1
  logs each second's wait and the ROM address of every NPC's script, to
  name a scene that holds the camera.
- TMC_ROOMCAP_CLEAN: the room alone -- the game's own HUD hide flags
  (HUD_HIDE_ALL), Link not drawn, dialogue advanced with A.
- TMC_ROOMCAP_PROGRESS=<n> (tour): the new game starts past the prologue
  with n dungeons cleared: TABIDACHI and LV1..n_CLEAR, and what the game
  hands out by then -- each dungeon's element, since an area change takes
  a clear back without it (gameUtils.c), which dropped Hyrule Town back to
  the prologue's, whose intro scene (script_Npc4EIntroTown) then held the
  camera; and the kinstone bag, without which the town plays Ezlo's
  kinstone scene.
- The single capture logs its camera too ("[roomcap] view ...").

build.py: GIT_TERMINAL_PROMPT=0 for the per-submodule fetch, so a
private submodule fails instead of stopping the build at a
"Username for github.com" prompt.
The 3D room view guesses each tile's shape from collision alone and takes
per-area fixes from voxel_shapes.json, edited by hand from F8 a tile at a
time. assets/voxel_shapes.json fixes 475 tile types in 57 areas up front:

- prop: bushes, saplings, rocks, pots, stumps, mushrooms, stones,
  boulders, planters, fences and signposts -- standing cards, where a run
  of them would otherwise stand up as a block;
- block: partly solid tiles the collision test leaves flat -- tree-canopy
  edges, cliff corners, stone walls, building corners and roofs.

Only where the view's own guess differs, and only tile types whose cells
agree (80%). Water and holes are left to the view. No wall heights.

build.py stages it into dist/ next to the binary, merged under an
existing voxel_shapes.json: the player's own entries win, tile by tile.

Generated from room dumps by tools/voxel_shapes.py in HelaFaye/tmc (vr
branch), from its tile identification; the file holds tile type numbers
and shape names only.
Room geometry standing between the camera and an actor (Link, or any
ENEMY in the entity lists) thins to a 20% dither around the sight line,
so the actor stays in sight: a house front, a cliff, a roof. With more
camera angles it is also the back of a wall seen from outside. A pixel
thins when it lies within 20 px (feathered over 14) of the line from the
camera to the actor, aimed 12 px above its feet, in front of the actor,
and above the ground it stands on -- the floor under Link never thins.

The dither is a 4x4 Bayer screen door: each pixel is drawn or dropped,
so what is drawn stays opaque and writes depth -- no sorting. Only room
geometry (kind 0) thins; sprites, the backdrop and the HUD never do.

- voxel.vert passes the world position; voxel.frag fadeKeep(), with the
  camera and up to 16 actors in a fragment uniform (set 3) pushed each
  frame from Port_Voxel_Present. SPIR-V rebuilt (voxel only).
- F8 > Display > 3D walls out of the way (voxel_wall_fade, on by default).

Built with --gpu_renderer=y. Not yet seen running: the machine it was
written on has no Vulkan display.
A solid tile with no solid tile beside it already stands as a prop card:
5 such prop entries drop out, and 17 lone solid tiles that belong to a
wall or tree get block, so the view does not stand them as cards. 510
tile types in 59 areas.
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