Viewer: light emissive shaders of any class (SIX-208) #271

Manually merged
github merged 4 commits from gh-pr/271/head into gh-pr/271/base 2026-11-26 20:23:22 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 13:18 UTC · original
holdmysocks:six-viewer-emissive-any-class → master · +43 −3 · 6 files · 4 commits · merged 2026-11-25 14:26 UTC

Stacked on #268, so merge that first.

The viewer lit only materials classed emissive. Some emissive shaders sit in another class: a bulb's standard_emissive_layer_inst is cutout, and neon sign tubes are opaque. The GLB lights them through their emissive texture, but the viewer left them dark.

Now a material lights in the viewer when its class is emissive or the GLB gives it an emissive texture. The export sets that texture only on materials whose shader lights. Such a material gets bit 12 of the material flags. The shader then adds its emissive map with the same per-material scale as class 7 (#268).

Checked

  • Night screenshots: the neon fish sign's tubes and an LED strip now light. A plain prop (a tablet) and the circular LED sign look as before.
  • cargo check --workspace --all-targets and cargo test -p sixng-core -p sixng-gui --release pass. A new test covers which materials light.

Not done

  • The candle bulb's filament is lit but stays hidden. Its glass shell (standard_alpha_inst) is drawn opaque, because the alpha of its colour texture is constant. Where the glass gets its opacity from is not traced.
  • Neon tubes light white. Their emissive map is a white mask, and the tube colour is not in it.
  • The Metal 4 renderer is not changed.
**@⁠holdmysocks** on GitHub · 2026-11-25 13:18 UTC · [original](https://github.com/holdmysocks/SixNG/pull/271) `holdmysocks:six-viewer-emissive-any-class` → `master` · +43 −3 · 6 files · 4 commits · merged 2026-11-25 14:26 UTC Stacked on #268, so merge that first. The viewer lit only materials classed `emissive`. Some emissive shaders sit in another class: a bulb's `standard_emissive_layer_inst` is cutout, and neon sign tubes are opaque. The GLB lights them through their emissive texture, but the viewer left them dark. Now a material lights in the viewer when its class is `emissive` or the GLB gives it an emissive texture. The export sets that texture only on materials whose shader lights. Such a material gets bit 12 of the material flags. The shader then adds its emissive map with the same per-material scale as class 7 (#268). ## Checked - Night screenshots: the neon fish sign's tubes and an LED strip now light. A plain prop (a tablet) and the circular LED sign look as before. - `cargo check --workspace --all-targets` and `cargo test -p sixng-core -p sixng-gui --release` pass. A new test covers which materials light. ## Not done - The candle bulb's filament is lit but stays hidden. Its glass shell (`standard_alpha_inst`) is drawn opaque, because the alpha of its colour texture is constant. Where the glass gets its opacity from is not traced. - Neon tubes light white. Their emissive map is a white mask, and the tube colour is not in it. - The Metal 4 renderer is not changed.
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.
The viewer lit only class emissive. Emissive shaders that sit in another
class (a bulb's emissive layer is cutout, neon tubes opaque) are lit in the
GLB but were dark in the viewer. A material with an emissive texture in the
GLB now lights too (flags.w bit 12), scaled like class 7.
# Conflicts:
#	crates/sixng-gui/src/cells.rs
#	crates/sixng-gui/src/glb.rs
#	crates/sixng-gui/src/render3d.rs
#	crates/sixng-gui/src/render3d_metal4.rs
#	crates/sixng-gui/src/world3d.rs
# Conflicts:
#	crates/sixng-gui/src/shader.wgsl
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:23:19 +00:00
github manually merged commit 3c9db5c994 into gh-pr/271/base 2026-11-26 20:23:22 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.