docs: aetheria-release map section IG (inventory grid grammar decoded, SDF constants)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8c692862eb
commit
b46865bec8
1 changed files with 99 additions and 0 deletions
|
|
@ -11575,3 +11575,102 @@ deletion) is agent.
|
|||
- `aetheria-release:question:art-over-unbuilt-hull-source` (recommended `art-takes-over`, raised in the spec, which it
|
||||
blocks).
|
||||
- `aetheria-release:cut_spec:cut-package-agent-hull-guards.r2`, superseding r1.
|
||||
|
||||
## Inventory grid as one SDF shader (IG)
|
||||
|
||||
Ruling `aetheria-release:ruling:inventory-grid-is-one-sdf-shader`. Imagination pass `invgrid-map`, 2026-11-29, at master `8c692862e`. Spec `aetheria-release:cut_spec:cut-inventory-grid-shader.r1`; follow-ups `inventory-grid-switch`, `inventory-grid-deletes`. The decoder scripts (`sheet.py`, `decode.py`, `grammar.py`, `thermfit3.py`) are in that pass's scratchpad. Each result below comes from running them.
|
||||
|
||||
### Body facts (IG-B)
|
||||
|
||||
- IG-B1 Sheets. `Nodes8.png` (160x320) holds 512 sprites named `Nodes8_<i>`. `Nodes8BG.png` (160x160) holds 256 named `Nodes8BG_<i>`. Every sprite:
|
||||
- is 8x8 on a 10 px stride, with a 1 px pad copied from the sprite's own edge texels;
|
||||
- has border 4/4/4/4 and PPU 66;
|
||||
- is bilinear, with no mips, uncompressed, `sRGBTexture: 0`.
|
||||
|
||||
Array index i of `NodeTextures` and of `NodeBackgroundTextures` is the sprite named `_i`; this was checked for all 768 sprites. RGB is white everywhere, and only alpha carries the look. Alpha takes four values: 0, 13 (fill), 51 (rule) and 255 (bracket, BG).
|
||||
- IG-B2 Masks. `_offsets` (InventoryPanel.cs:84) sets the bits: 0 up, 1 right, 2 down, 3 left, 4 up-right, 5 down-right, 6 down-left, 7 up-left. A set bit means the neighbour does not match (an edge). Bit 8 means an item is present (icon only). The BG index uses the same 8 bits. Every panel's mask is in screen directions:
|
||||
- the menu and HUD grids start LowerLeft with Flip 0;
|
||||
- the Enemy grid starts UpperRight with Flip 1, and negating the offsets cancels the 180-degree layout.
|
||||
- IG-B3 Grammar, as `grammar.py` regenerates it. Every sprite is four 4x4 quadrants. Each quadrant is a function of its vertical edge bit v, its horizontal edge bit h, its diagonal bit d, and the item bit. In the TL frame, r and c count texels from the outer corner.
|
||||
- Rule: if v, row 1 is alpha 51; if h, column 1 is alpha 51.
|
||||
- Convex corner (v and h): the rule starts at the corner, and (1,1), (1,2) and (2,1) are 255. Nothing lies outside it.
|
||||
- Concave corner (not v, not h, d): (0,1), (1,0) and (1,1) are 255.
|
||||
- One edge only (v xor h): the rule alone; d is ignored.
|
||||
- Fill region F = {(r,c): (not v or r>=3) and (not h or c>=3) and not (concave and r<3 and c<3)}. The icon is 13 on F when the item bit is set. The BG is 255 on F always.
|
||||
|
||||
Put plainly: the outline is the region boundary inset to texel row 1. Every corner, convex or concave, lights its corner texel and one texel along each arm. The fill and BG are the region inset by three texels, with square corners.
|
||||
|
||||
The grammar regenerates 767 of the 768 sprites exactly, so the 256 masks do reduce to per-quadrant rules. The one exception is mask 33 (up edge plus a down-right concave corner). `Nodes8BG_33` and `Nodes8_289` have five extra texels at row 2, columns 0 to 4, so the BG and fill start one texel higher under the top rule. None of the mask's rotations carries the same texels, so this is an authoring slip, not grammar.
|
||||
- IG-B4 Thermal. `ThermalTextures` is `pipes.psd`: 16 sprites named `pipes_<i>`, each 32x32 with no border, PPU 100, sRGB. With no border, a Sliced Image draws them Simple, so they stretch with the cell.
|
||||
- The mask is 4 bits (up, right, down, left) and reads `HullConductivity` (InventoryPanel.cs:719-738).
|
||||
- The shape is a centre blob plus a pipe to each conducting edge.
|
||||
- The best SDF fit (`thermfit3.py`), in px of 32: circle R 4.0, pipe half-width 4.2, smooth-min k 1, AA ramp 1.25. Worst rms is 0.052 and worst texel error 0.44, at the inner fillets. These are starting constants, not a match.
|
||||
- IG-B5 Prototypes. In Inventory.prefab, `Inventory Cell` (2420):
|
||||
- Background: a Sliced Image, PPU multiplier 1, default UI material, raycastTarget 1.
|
||||
- Icon: Sliced, multiplier 1, `Additive UI.mat` (UI/Additive, `Blend SrcAlpha One`, AdditiveUI.shader), raycastTarget 0.
|
||||
|
||||
The HUD and Enemy cells in ARPG.unity are the same, except that Icon's multiplier is 1.5 (lines 1274 and 31855).
|
||||
- IG-B6 Layout. In Inventory.prefab, Content holds a GridLayoutGroup (cell 32, padding 8, LowerLeft, middle-centre, fixed column count) and a ContentSizeFitter (preferred, preferred). It sits under Viewport (Mask, stencil) in a ScrollRect.
|
||||
- HUD: `Canvas/Gameplay/Hud Schematic/Inventory/Schematic`, rect 254x260, cell 16 with FitToContent.
|
||||
- Enemy: rect 260x260, UpperRight, Flip 1, cell 16 with FitToContent.
|
||||
- FitToContent sets cell = floor(min(W/(w+1), H/(h+1))) (InventoryPanel.cs:272).
|
||||
- Canvas: ScaleWithScreenSize 1920x1080, matched on width, reference PPU 100. Linear colour space, `m_VertexColorAlwaysGammaSpace: 0`.
|
||||
- IG-B7 What writes cell pixels today:
|
||||
- RefreshCells sets the sprites and Icon.color.
|
||||
- GetColor, including `_hud`, computes the tint.
|
||||
- `Pulse` writes Background.color every frame.
|
||||
- InventoryMenu.cs:87-106 and 142-160 write `CellInstances[v].Icon.color` for the selection highlight. This is a foreign writer, and the next RefreshCells loses the highlight.
|
||||
- The drag ghost is `Instantiate` copies of the item's cells at half alpha (InventoryPanel.cs:338-350 and 563-575).
|
||||
- `TemperatureDisplay` is a RawImage under the cells, as the first sibling. It uses a (w+2)x(h+2) Texture2D rewritten every frame and an additive screen-space-detail material. Its position comes from `_firstRect`.
|
||||
- IG-B8 Consumers. Only Inventory.prefab and ARPG.unity reference the sheets and InventoryCell. No script loads them by path.
|
||||
|
||||
### Screen geometry of the nine-slice (IG-G): the SDF constants
|
||||
|
||||
Image.pixelsPerUnit = 66/100 x the multiplier, so one texel is t = 100/(66 m) canvas units:
|
||||
- t = 1.51515 at m = 1 (every BG, and the menu icon);
|
||||
- t = 1.01010 at m = 1.5 (the HUD and Enemy icon).
|
||||
|
||||
Each corner region is B = 4t: 6.06 or 4.04 units. When a cell is smaller than 8t on an axis, Unity clamps the borders (GetAdjustedBorders), so t_eff = min(t, S/8) per axis. The 16-unit HUD cells of large hulls fall in that regime.
|
||||
|
||||
Each axis of a cell of size S maps to texel space u:
|
||||
- u = p/t_eff for p < B;
|
||||
- u = 8 - (S-p)/t_eff for p > S-B;
|
||||
- u = 4 exactly in between, because the middle quads have a zero-wide UV range and sample the seam between texels 3 and 4.
|
||||
|
||||
The pixel is the bilinear sample of the virtual 8x8 grammar sprite at u, clamped to the cell's own texels. Because the pads copy the edge texels, nothing bleeds between cells.
|
||||
|
||||
As shapes, use texel boxes with a separable linear falloff f(d) = saturate(1 - d/soft), where soft = t_eff:
|
||||
- Rule: centre line 1.5t in from the boundary, width t, alpha 0.2.
|
||||
- Bracket (convex and concave alike): alpha 1 from the corner's texel centre for one texel along each arm, then ramping linearly to 0.2 over the next texel.
|
||||
- Fill and BG: the region inset by 3t, with square corners. Fill alpha is 13/255. BG alpha is 1 x CellBackgroundColor.
|
||||
|
||||
With soft = t_eff this equals today's render exactly. At 1920 wide, one canvas unit is one pixel, so the menu rule's tent has a 1.5 px half-width; at 2560 wide it is 2.0 px.
|
||||
|
||||
Composite in one pass with `Blend One OneMinusSrcAlpha`:
|
||||
- rgb = bg.rgb x a_bg + icon.rgb x a_icon
|
||||
- a = a_bg
|
||||
|
||||
This equals today's alpha-blended Background followed by the additive Icon, because cells never overlap. Thermal mode swaps the icon term for the pipes shape.
|
||||
|
||||
### Authority (IG-A): the target after cut 3
|
||||
|
||||
- Owner: InventoryPanel.RefreshCells is the only writer of the panel's cell records: mask, item bit, conductivity bits, icon colour and BG colour. InventoryGrid, a MaskableGraphic, owns the cell layout, the pixels and point-to-cell. The shader owns no rule.
|
||||
- Demotions:
|
||||
- The match predicates stay on the CPU, in RefreshCells, unchanged.
|
||||
- GridLayoutGroup is no longer an owner. Cell rects derive from InventoryGrid's size, padding and orientation.
|
||||
- Flip is no longer a separate fact; it is derived from the grid's orientation.
|
||||
- The selection highlight becomes a panel call, `InventoryPanel.SetHighlight(cells, on)`.
|
||||
- Pulse writes the BG colour through the same record setter.
|
||||
- The drag ghost is a second InventoryGrid, fed a snapshot of the item's records at half alpha.
|
||||
- TemperatureDisplay is placed from InventoryGrid's cell rect (-1,-1).
|
||||
- Forbidden writers:
|
||||
- any write to an Image on a cell;
|
||||
- `CellInstances[...]` outside InventoryPanel;
|
||||
- `Instantiate(CellInstances[...])`;
|
||||
- `_firstRect`.
|
||||
|
||||
### Rationale (IG-R)
|
||||
|
||||
- The mask is stored in the record, not derived in the shader, because the match relation is asymmetric. An interior no-hardpoint cell holding item X matches a hardpoint cell holding X, but the hardpoint cell does not match it back (InventoryPanel.cs:679-699). Deriving matches in HLSL would make a second owner of those rules.
|
||||
- The shapes are texel boxes evaluated through the nine-slice remap. That is what lets the parity bound be quantisation-only (see the spec) rather than a perceptual threshold.
|
||||
- Cut order: first the parked renderer and a parity harness against the live sheets, then the switch, then the deletes. The sheet oracle has to exist while the shader is judged, and the subtraction is falsified on its own.
|
||||
|
|
|
|||
Loading…
Reference in a new issue