Export: emissive strength from each material's emissivemultiplier (SIX-208) #268

Manually merged
github merged 1 commit from gh-pr/268/head into gh-pr/268/base 2026-11-26 20:23:03 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 13:03 UTC · original
holdmysocks:six-emissive-strength → master · +275 −4 · 9 files · 1 commits · merged 2026-11-25 13:49 UTC

Every emissive material in a GLB lit at emissiveFactor [1, 1, 1]. The game stores how bright each one is in the material constant emissivemultiplier, which #262 put in model.json. The GLB now uses it.

Mapping

The values read like luminance in nits: 5 on glass railings, 628 on bulbs, 1000 on LED sign displays, 3225 on a circular LED sign.

  • strength = multiplier / 100, so 1.0 in the glTF is 100 nits (about display white). The highest strength written is 100 (10 000 nits).
  • A strength up to 1 is the emissiveFactor. Above 1, the factor is 1 and KHR_materials_emissive_strength holds the strength, as that extension asks. It is listed in extensionsUsed.
  • A multiplier of 0 is a light the game switches on while it runs (a traffic-light counter, some LED bulbs and chase strips). It stays lit at strength 1, the same as a material with no multiplier, so it does not export dark.
  • model.json and materials.json materials[] and the GLB material extras get emissive_strength: {multiplier, strength, source}. source is multiplier, capped, default (no multiplier) or runtime (multiplier 0). It is null for materials that do not light. The model.json materials_note explains it.

Viewer

Emissive materials are now scaled by the square root of their glTF strength, kept between 0.25 and 3. A linear scale would turn the dim lights black and the bright signs flat white at the viewer's fixed exposure. Exports without the extension look as before. The Metal 4 renderer is not changed.

Checked

  • 493 emissive models exported from levels.rpf (bulbs, LED signs and strips, neon signs, glass railings): 524 lit materials. 463 take their strength from the multiplier, 25 are capped, 27 have a multiplier of 0, and 9 have none. Every GLB strength (factor × extension) matches model.json, and every GLB with the extension lists it in extensionsUsed.
  • The multiplier ranges from 0 to 90 000, with a median of 600 (strength 6).
  • Night screenshots of a circular LED sign, a candle bulb, a neon fish sign and glass railings in the viewer.
  • cargo check --workspace --all-targets and cargo test -p sixng-core -p sixng-gui --release pass. New tests cover the mapping (railings, bulb, LED sign, 0, missing or invalid values, the cap), reading the constant from a material, extensionsUsed, and the viewer's scale.

Not done

  • The viewer lights only materials classed emissive. Emissive shaders in another class (the bulbs' standard_emissive_layer_inst, which is cutout, and the neon signs) are lit in the GLB but not in the viewer. This is not new.
**@⁠holdmysocks** on GitHub · 2026-11-25 13:03 UTC · [original](https://github.com/holdmysocks/SixNG/pull/268) `holdmysocks:six-emissive-strength` → `master` · +275 −4 · 9 files · 1 commits · merged 2026-11-25 13:49 UTC Every emissive material in a GLB lit at `emissiveFactor` [1, 1, 1]. The game stores how bright each one is in the material constant `emissivemultiplier`, which #262 put in model.json. The GLB now uses it. ## Mapping The values read like luminance in nits: 5 on glass railings, 628 on bulbs, 1000 on LED sign displays, 3225 on a circular LED sign. - strength = multiplier / 100, so 1.0 in the glTF is 100 nits (about display white). The highest strength written is 100 (10 000 nits). - A strength up to 1 is the `emissiveFactor`. Above 1, the factor is 1 and `KHR_materials_emissive_strength` holds the strength, as that extension asks. It is listed in `extensionsUsed`. - A multiplier of 0 is a light the game switches on while it runs (a traffic-light counter, some LED bulbs and chase strips). It stays lit at strength 1, the same as a material with no multiplier, so it does not export dark. - model.json and materials.json `materials[]` and the GLB material extras get `emissive_strength`: `{multiplier, strength, source}`. `source` is `multiplier`, `capped`, `default` (no multiplier) or `runtime` (multiplier 0). It is null for materials that do not light. The model.json `materials_note` explains it. ## Viewer Emissive materials are now scaled by the square root of their glTF strength, kept between 0.25 and 3. A linear scale would turn the dim lights black and the bright signs flat white at the viewer's fixed exposure. Exports without the extension look as before. The Metal 4 renderer is not changed. ## Checked - 493 emissive models exported from levels.rpf (bulbs, LED signs and strips, neon signs, glass railings): 524 lit materials. 463 take their strength from the multiplier, 25 are capped, 27 have a multiplier of 0, and 9 have none. Every GLB strength (factor × extension) matches model.json, and every GLB with the extension lists it in `extensionsUsed`. - The multiplier ranges from 0 to 90 000, with a median of 600 (strength 6). - Night screenshots of a circular LED sign, a candle bulb, a neon fish sign and glass railings in the viewer. - `cargo check --workspace --all-targets` and `cargo test -p sixng-core -p sixng-gui --release` pass. New tests cover the mapping (railings, bulb, LED sign, 0, missing or invalid values, the cap), reading the constant from a material, `extensionsUsed`, and the viewer's scale. ## Not done - The viewer lights only materials classed `emissive`. Emissive shaders in another class (the bulbs' `standard_emissive_layer_inst`, which is cutout, and the neon signs) are lit in the GLB but not in the viewer. This is not new.
strength = multiplier / 100 (1.0 = 100 nits), at most 100. Up to 1 it is
the emissiveFactor; above 1 the factor is 1 and KHR_materials_emissive_strength
holds the strength (listed in extensionsUsed). A multiplier of 0 (switched on
at run time) stays lit at strength 1. model.json, materials.json and the GLB
extras get emissive_strength {multiplier, strength, source}. The viewer scales
emissive materials by the square root of the strength, kept in 0.25..3.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:23:01 +00:00
github manually merged commit a6bc4f8e84 into gh-pr/268/base 2026-11-26 20:23:03 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.