How Legaia turns a texture into the colour you see on screen - and why an exported texture's palettes can look wrong. A texel is only an index; its colour comes out of video memory, not the texture's file; the GPU then multiplies it by a colour painted into the mesh. Only a small set of mesh rows is lit by a light source; everything else is painted.
0x0000 is never drawn; 0x8000 is opaque black.out = texel × colour / 128. 0x80 is neutral; most field surfaces sit below it, so they draw darker than their texture.0x10..=0x17), shaded by the GTE light. Everything else uses its baked colour plus the depth cue.texel × far / 128, not the far colour itself.((CBA & 0x3F) × 16, CBA >> 6) - whatever the last upload left there.0x0000 entry skips the texel, opaque primitive or not.c + (far − c) × IR0 / 4096; unfogged field scenes use IR0 = 0.B/2+F/2, B+F, B−F or B+F/4, on 5-bit channels and truncated - the console averages (B+F)>>1; PCSX-Redux does too on textured polygons but halves each side first on sprites and untextured flats. PSX mode blends the same way on both hosts.An export decodes the image through one of the file's own palettes. Three Legaia habits make that differ from the game:
A multi-row palette block also lands in VRAM as one flat strip on a single row, so "palette N" of a TIM is the cell 16×N entries along that row, not row N.
The asset viewer's TIM catalog resolves these from your disc: its Palette list offers As the game draws it for the menu / battle UI sheet (every sprite through the palette the game uses for it, taken from the widget-class table), lists the palettes video memory really holds on the texture's row, and notes when a texture's own palette is never used or is all zeros. The ROM patcher's texture editor reads the same map.
Every mesh polygon carries a colour painted by the artists, one per corner on smooth-shaded polygons. The GPU multiplies the texture by it, with 0x80 meaning "unchanged". A texel of (200, 100, 50) under 0x60 shows as (150, 75, 37); under 0xC0 it clamps to (255, 150, 75). Roughly four in five colour components in the field scenes sit below 0x80. Menu and HUD sprites are drawn at exactly 0x80, which is why a UI sheet decoded through the right palette matches the screen and a field texture does not.
The light-source rows are the exception. They carry a normal instead of a colour word, and the GTE computes their colour from the scene light: the back colour (0x20 a channel unless a script changes it) plus the light's intensity against the face, times the object colour. A face turned away from the light keeps about an eighth of its texel. cave01's rock walls are built entirely from such rows; most scenes hold few or none (formula).
Battles add two runtime terms: an ambient that the ground grid is shaded from (it dims while a summon is on screen and fades in at the start of every fight), and a per-actor tint that darkens distant bodies, colours status ailments and draws a rotted limb dark.
| Mechanism | What moves | More |
|---|---|---|
| Palette walk (frames copied into the live cell) | water, waterfalls, the world-map ocean | World map |
| Hue / brightness cycler | "pulsating flesh", lightning flashes | field ambient FX |
Scripted palette family (field-VM 4C 61) | fades and one-shot palette stamps | Script VM |
| Prologue palette collapse | every uploaded palette rewritten to gold sepia | Cutscene |
An export shows the disc state, so a palette that looks like a strip of near-identical ramps is often a set of animation frames waiting to be walked into the live cell.
0x0000 is "not drawn" everywhere; use 0x8000 for black.Replacing a texture on your disc is done in the ROM patcher; the byte-level rules are on the TIM page.
The depth cue works on the packet's colour word, and the GPU multiplies the texel by the result afterwards. So a textured primitive's far colour is texel * FC / 128, not FC. The order also decides what clips. The multiply saturates, so a bright texel under a bright colour clips only after the cue has dimmed that colour: an ice floor's texel (169, 190, 204) under near colour 0xC0, cued a third of the way to 0x40, keeps its hue. Blending the two modulated pixels instead gives the same result until the near pixel clips, then a grey, low-contrast floor. Both hosts cue the colour first (psx_cue_colour in the shader prelude).
The renderer's two halves point opposite ways. Shading defaults to retail: the baked colour word, the depth cue and the light-source rows, with no synthetic light on any game path (the play hosts layer the optional enhanced lighting over it). Rasterisation defaults to clean: the GTE register limits, vertex snap and the 15-bit dither are behind set_psx_mode. Affine UVs are not gated - they are always on, because they are the faithful behaviour.
legaia_ui_formats::tim_palette_context (which cell draws which texel; what the boot VRAM holds)engine-render (1024×512 R16Uint texture, decode in the fragment shader)psx_modulate / psx_depth_cue / psx_blend / psx_dither in the shader prelude, CPU mirror psx_lightrender-kernels::field_light, engine-field::field_lit_meshengine-battle-vm::battle_ground_grid, battle_actor_tintengine-field::clut_cell_fx, legaia_scene_formats::clut_walk