Batches: name the layer-blend byte of prop instances #382

Manually merged
github merged 3 commits from gh-pr/382/head into gh-pr/382/base 2026-11-26 20:32:13 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-26 17:16 UTC · original
holdmysocks:blend-b-instance → master · +34 −7 · 4 files · 3 commits · merged 2026-11-26 18:34 UTC

The per-instance value b in the two-layer blend (`m = b if b + instance_switch < 1, else min(blendintensity, 3 b)`) was assumed to be 1. This PR traces where it comes from.

Batch props (prop_2lyr_batch drawn instanced): the mesh program reads the 64-byte batch instance record as it is. It loads the 3x4 matrix at +0x00, the tint at +0x34 and the dword at +0x3C. It passes byte +0x3E / 255 as b and byte +0x3F / 255 next to it. The pixel program feeds +0x3F into a desaturation of the blended colour.

  • Over all prop batch instances, the two bytes are equal on 96 %.
  • On instances of models with 2-layer materials, 96 % are 255 / 255. The rest are 0 / 0 across whole batches, which turns layer 2 off for those instances.

Other placements: b is byte 3 of the first dword of the draw's 32-byte per-instance record. The code that fills it from the placement was not read. Two u8 entity fields that default to 255 (0dc5f270, 540ca436) are candidates, but they differ from each other on most entities.

Changes:

  • `PropInstance` gets `layer_blend` (+0x3E) and `layer_aux` (+0x3F). `raw` keeps the still-unknown f32 / f32 / u16.
  • The two-layer blend text (`inputs.b`, `not_read`) says where b comes from.
  • Tests: the synthetic batch test checks both bytes. The blend test checks the b source text.

Export: the batch export also writes batch_props_layer.bin, 2 bytes per prop instance in batch_props.bin order (layer_blend, layer_aux). It is a separate file so the 44-byte records and their readers stay as they are. Checked on a regional export: 1,102,571 records in both files.

**@⁠holdmysocks** on GitHub · 2026-11-26 17:16 UTC · [original](https://github.com/holdmysocks/SixNG/pull/382) `holdmysocks:blend-b-instance` → `master` · +34 −7 · 4 files · 3 commits · merged 2026-11-26 18:34 UTC The per-instance value b in the two-layer blend (\`m = b if b + instance_switch < 1, else min(blendintensity, 3 b)\`) was assumed to be 1. This PR traces where it comes from. **Batch props** (prop_2lyr_batch drawn instanced): the mesh program reads the 64-byte batch instance record as it is. It loads the 3x4 matrix at +0x00, the tint at +0x34 and the dword at +0x3C. It passes byte +0x3E / 255 as b and byte +0x3F / 255 next to it. The pixel program feeds +0x3F into a desaturation of the blended colour. - Over all prop batch instances, the two bytes are equal on 96 %. - On instances of models with 2-layer materials, 96 % are 255 / 255. The rest are 0 / 0 across whole batches, which turns layer 2 off for those instances. **Other placements:** b is byte 3 of the first dword of the draw's 32-byte per-instance record. The code that fills it from the placement was not read. Two u8 entity fields that default to 255 (0dc5f270, 540ca436) are candidates, but they differ from each other on most entities. Changes: - \`PropInstance\` gets \`layer_blend\` (+0x3E) and \`layer_aux\` (+0x3F). \`raw\` keeps the still-unknown f32 / f32 / u16. - The two-layer blend text (\`inputs.b\`, \`not_read\`) says where b comes from. - Tests: the synthetic batch test checks both bytes. The blend test checks the b source text. Export: the batch export also writes `batch_props_layer.bin`, 2 bytes per prop instance in `batch_props.bin` order (layer_blend, layer_aux). It is a separate file so the 44-byte records and their readers stay as they are. Checked on a regional export: 1,102,571 records in both files.
The 2-layer prop shaders read the 64-byte batch instance record as it is
and take +0x3E / 255 as the per-instance value b of the layer-2 blend,
+0x3F / 255 beside it. Decode both as layer_blend / layer_aux and say in
the two-layer blend text where b comes from.
batch_props_layer.bin holds layer_blend and layer_aux, 2 bytes per prop
instance in batch_props.bin order. A separate file, so readers of the
44-byte records keep working.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:32:11 +00:00
github manually merged commit 9959fe6e25 into gh-pr/382/base 2026-11-26 20:32:13 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.