feat(client): terrain Z rendering, foot points, height-aware picking + fixture (Slice B of #224) #227
No reviewers
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo!227
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/terrain-z-render"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice B of #224 (UO heightfield) — the visible slice. Stacked on Slice A (#225); base is
feat/terrain-z-domain, so this diff is only Slice B. Merge #225 first.Summary
Makes terrain Z actually render and interact, integrated into the SDF windowed renderer (not the per-tile dual-tile mesh the original prompt assumed — that renderer no longer exists):
IsoProjection.ToScreen(x,y,GroundZAt), texcoord = the flat(x,y), two triangles per cell;ground_blend.fxis unchanged. Shared vertices ⇒ no cracks. Cost stays bounded by the viewport. On a flat (all-Z0) map the mesh is coplanar and renders pixel-identical to before.ToScreen(x,y,GroundZAt)so nothing floats or sinks (a foot uses the sameGroundZAtas the mesh vertex, so it sits exactly on the surface).TerrainPicker(pure, inClient.Core) tests the cursor against the map's real Z-lifted triangles and returns the frontmost hit;TileUnderCursoruses it instead of the flat inverse, so clicking a raised plateau selects the plateau, not the tile it's drawn over.content/maps/fixtures/,scripts/genzfixture.py) — ramps (X/Y/diagonal), a non-coplanar saddle, asalt_plainplateau, an over-MaxStepZcliff, and a static + spawn on the plateau. Never touches the real world map (loaded by copying the three fixture files over the bin-outputworld.*for a screenshot).No wire change (
ProtocolVersionuntouched). The Map Editor's own Z tools + server walkability are Slice C.Screenshots / recording
Piloted via the debug harness on the fixture (fresh DB), plus a flat-world regression check. The plateau is a bright
salt_plainmesa (Z20) on darkrocky_groundfor legibility; our SDF blend feathers the cliff into a stretched gradient (that softness is the blend, not the geometry — the mesh is a hard step, proven below).zC_plateau) — the player + a boulder stand on the raisedsalt_plain; the golddesert_sandramp climbs at left; nothing floats.zC_front) — the mesa and its ramp from flat ground in front.zC_ramp) — aftergotoup the 2-Z/cell ramp; each step glided up smoothly.zC_flat) — the shipped 3× world (Z0) renders identically to before the mesh conversion.How it was tested
IsoProjectionTests(ToScreen(x,y,0)==flat,+1 Z==Y−4);TerrainPickerTests— point-in-triangle (interior/exterior/either winding), flat pick, elevation-aware pick selects the raised cell, frontmost wins on overlap, null off-map.dotnet testall green (Client.Core 178, Shared 122, GameServer 271, …).goto 24 13traversed it, Z interpolated); correct ordering around the plateau/cliff (player on the plateau edge not hidden by the lower ground in front); picking selects the visible elevated tile (a click on the plateau loggedtile z=20, a flat clickz=0); flat Z0 rendering pixel-identical (redwood spawn matched); Z clamped −225..255 (rejected inElevationTests).(x,y)as texcoord and the shader blends per-pixel, so a fixedv00–v11diagonal + shared vertices already guarantee no cracks and correct texture. (ClassicUO source wasn't reachable via the tooling here; noted rather than faked.)Checklist
just lintpasses (CSharpier + analyzers, zero warnings)just testis greenDrawUserIndexedPrimitives, pureClient.Coremath; no OS-specific API; shader stays the pre-compiled.xnb)MaxStepZwalkability are Slice CScreenshots (harness — fixture + flat regression)
On the plateau — player + boulder on the raised salt_plain; gold ramp at left; nothing floats
Front view of the mesa + ramp from flat ground
After walking up the 2-Z/cell ramp (Z interpolated per step)
Flat regression — the shipped Z0 world renders identical to before the mesh