Lights: real values in world.jsonl again; distant / LOD lights; timecycle modifier regions #255

Manually merged
github merged 1 commit from gh-pr/255/head into gh-pr/255/base 2026-11-26 20:21:57 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 06:53 UTC · original
holdmysocks:six-168-lights → master · +464 −42 · 6 files · 1 commits · merged 2026-11-25 07:03 UTC

Three lighting exports from sixng lights, all from one pass over the map files.

Placed lights: real values again (SIX-168)

Since the light fields got their names (intensity, lightType, falloff, ...), lights.rs still looked them up by hash, so world.jsonl wrote intensity, range and type as 0 for every placed light. Light fields are now read by member hash (Meta::scalars_by_hash), so new names can't change what the export reads. world.jsonl now carries every field of the light: time flags, falloff exponent, corona, volumetric and fade fields, second and third colours, tangent, and every scalar field by name under fields.

Checked against the 2026-11-20 export with the same bbox: 145,157 lights, none at 0. Of the 114,816 lights both exports share, 99.4 % match on type, intensity, range, cone and colour. The rest are archetypes with more than one light set, where the first set wins as before.

Distant / LOD lights (SIX-192)

Each CMapData has DistantLODLightsSOA and LODLightsSOA, structures of arrays with one value per light. Their hashes are the joaat of the GTA V names. Each distant light file is paired with the LOD light file whose parent is its name, and the two are joined by index.

  • distant.jsonl: 492,298 lights from 2,873 files, 2,871 of them paired. Each has world position, colour, intensity, type, flags, hash and a half-float time multiplier. From the LOD file it gets direction, range, falloff exponent and cone (u8 = degrees × 255 / 180). Raw columns are kept under distant_raw and lod_raw.
  • distant_groups.jsonl: per distant file, its name, flags (2 or 3) and the members that aren't one value per light, such as the light groups (boxes with index lists) and the category.
  • lod.jsonl: LOD lights with no distant file to pair with (none in levels.rpf).

Check: of 725 sampled distant lights, 709 sit within 5 cm of a placed light with the same direction and type, and their ranges and cones match.

Timecycle modifier regions (SIX-179)

CMapData.timeCycleModifiers is empty in every file. The boxes are in another CMapData array (8471928b, struct 3bc4ac19): 586 boxes in 221 files. Each has the modifier name hash, center, rotation, scale, range, percentage, startHour, endHour and three fields not identified yet. 581 of the names resolve to sixng timecycle modifiers.

Interior rooms (CMloRoomDef) have timecycleName, secondaryTimecycleName and blend: 4,364 rooms. Both kinds go to tc_modifiers.jsonl.

Also

  • Meta::member_value decodes a single member. Arrays of arrays (element type 0x52, 16-byte headers) now decode instead of showing up as a placeholder.
  • The CLI output lists the new counts. The README Lights row is updated.
  • Tests: light fields read by hash whatever their names, plus the SOA split, the xyz flattening and the distant/LOD join.

cargo check --workspace --all-targets and cargo test -p sixng-core -p sixng-gui --release pass.

**@⁠holdmysocks** on GitHub · 2026-11-25 06:53 UTC · [original](https://github.com/holdmysocks/SixNG/pull/255) `holdmysocks:six-168-lights` → `master` · +464 −42 · 6 files · 1 commits · merged 2026-11-25 07:03 UTC Three lighting exports from `sixng lights`, all from one pass over the map files. ## Placed lights: real values again (SIX-168) Since the light fields got their names (`intensity`, `lightType`, `falloff`, ...), `lights.rs` still looked them up by hash, so `world.jsonl` wrote intensity, range and type as 0 for every placed light. Light fields are now read by member hash (`Meta::scalars_by_hash`), so new names can't change what the export reads. `world.jsonl` now carries every field of the light: time flags, falloff exponent, corona, volumetric and fade fields, second and third colours, tangent, and every scalar field by name under `fields`. Checked against the 2026-11-20 export with the same bbox: 145,157 lights, none at 0. Of the 114,816 lights both exports share, 99.4 % match on type, intensity, range, cone and colour. The rest are archetypes with more than one light set, where the first set wins as before. ## Distant / LOD lights (SIX-192) Each `CMapData` has `DistantLODLightsSOA` and `LODLightsSOA`, structures of arrays with one value per light. Their hashes are the joaat of the GTA V names. Each distant light file is paired with the LOD light file whose `parent` is its name, and the two are joined by index. - `distant.jsonl`: **492,298 lights** from 2,873 files, 2,871 of them paired. Each has world position, colour, intensity, type, flags, hash and a half-float time multiplier. From the LOD file it gets direction, range, falloff exponent and cone (u8 = degrees × 255 / 180). Raw columns are kept under `distant_raw` and `lod_raw`. - `distant_groups.jsonl`: per distant file, its name, flags (2 or 3) and the members that aren't one value per light, such as the light groups (boxes with index lists) and the category. - `lod.jsonl`: LOD lights with no distant file to pair with (none in `levels.rpf`). Check: of 725 sampled distant lights, 709 sit within 5 cm of a placed light with the same direction and type, and their ranges and cones match. ## Timecycle modifier regions (SIX-179) `CMapData.timeCycleModifiers` is empty in every file. The boxes are in another `CMapData` array (`8471928b`, struct `3bc4ac19`): **586 boxes in 221 files**. Each has the modifier name hash, `center`, `rotation`, `scale`, `range`, `percentage`, `startHour`, `endHour` and three fields not identified yet. 581 of the names resolve to `sixng timecycle` modifiers. Interior rooms (`CMloRoomDef`) have `timecycleName`, `secondaryTimecycleName` and `blend`: **4,364 rooms**. Both kinds go to `tc_modifiers.jsonl`. ## Also - `Meta::member_value` decodes a single member. Arrays of arrays (element type `0x52`, 16-byte headers) now decode instead of showing up as a placeholder. - The CLI output lists the new counts. The README Lights row is updated. - Tests: light fields read by hash whatever their names, plus the SOA split, the xyz flattening and the distant/LOD join. `cargo check --workspace --all-targets` and `cargo test -p sixng-core -p sixng-gui --release` pass.
world.jsonl read intensity, range and type by field hash after those
fields were given names, so every placed light came out as 0. Light
fields are now read by member hash, and world.jsonl carries every field
of the light record.

sixng lights also writes the map files' distant lights joined with their
LOD lights (distant.jsonl, distant_groups.jsonl) and the timecycle
modifier boxes and interior room modifiers (tc_modifiers.jsonl), with the
modifier names from the timecycle data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:21:56 +00:00
github manually merged commit f090b17859 into gh-pr/255/base 2026-11-26 20:21:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.