Emissive tint and bulb glass (SIX-208) #274

Manually merged
github merged 8 commits from gh-pr/274/head into gh-pr/274/base 2026-11-26 20:23:37 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 13:53 UTC · original
holdmysocks:six-emissive-tint-glass → master · +121 −13 · 8 files · 8 commits · merged 2026-11-25 14:57 UTC

Stacked on #271 (which is stacked on #268). It fixes the two problems listed in #271.

Neon tubes lit white

The emissive shaders have a float3 constant right after emissivemultiplier in their buffer, 7ab0fd74. Its name is not recovered. It is the colour of the light:

  • Neon signs carry blue, red, green and yellow values there over a white emissive map.
  • LEDs with their colour in the map carry white.
  • The glass railings carry blue.

In 523 emissive materials it is white on 324 and one of 32 colours on the rest. It is never black. Only emissive shaders (and standard_interior) have it.

  • Export: the tint is multiplied into the GLB emissiveFactor. It is written as emissive_strength.tint (null without one) in model.json, materials.json and the GLB extras, and the materials note explains it. A tint that is black, negative or not finite is ignored.
  • Viewer: the emissive light takes the tint (the factor divided by its brightest channel). A coloured light far above white washed out to white in the tone map. Its brightest channel is now capped at 1.2 after exposure, all channels in proportion. White lights are not capped.

Bulb filament hidden

The candle bulb's glass shell (standard_alpha_inst) has a colour texture with constant alpha 64. The rule that draws constant-alpha materials opaque was made for ped clothing, and it made the glass opaque too. The rule now skips the forward-alpha shader families from the family table (standard_alpha, standard_alpha_inst, standard_alpha_secmo, standard_anisotropy_dirt_alpha). Their alpha is their opacity. Shaders that are alpha only by their render-bucket flags (ped clothing) are still drawn opaque.

In the 493 sample models, 23 glass materials went back to BLEND. Two standard_dirt_alpha materials keep the rule.

Checked

  • Re-exported the 493 samples. GLB strength and tint match model.json in every material, and extensionsUsed is right.
  • Night screenshots: the candle bulb shows its white filament through the glass, the fish sign's tubes are light blue, a building's neon outline is teal and pink, and the glass railings glow blue.
  • cargo check --workspace --all-targets and cargo test -p sixng-core -p sixng-gui --release pass. New tests cover the tint (export, factor, invalid values, viewer colour) and the glass families versus bucket-only alpha.

The Metal 4 renderer is still not changed.

**@⁠holdmysocks** on GitHub · 2026-11-25 13:53 UTC · [original](https://github.com/holdmysocks/SixNG/pull/274) `holdmysocks:six-emissive-tint-glass` → `master` · +121 −13 · 8 files · 8 commits · merged 2026-11-25 14:57 UTC Stacked on #271 (which is stacked on #268). It fixes the two problems listed in #271. ## Neon tubes lit white The emissive shaders have a `float3` constant right after `emissivemultiplier` in their buffer, `7ab0fd74`. Its name is not recovered. It is the colour of the light: - Neon signs carry blue, red, green and yellow values there over a white emissive map. - LEDs with their colour in the map carry white. - The glass railings carry blue. In 523 emissive materials it is white on 324 and one of 32 colours on the rest. It is never black. Only emissive shaders (and `standard_interior`) have it. - **Export:** the tint is multiplied into the GLB `emissiveFactor`. It is written as `emissive_strength.tint` (null without one) in model.json, materials.json and the GLB extras, and the materials note explains it. A tint that is black, negative or not finite is ignored. - **Viewer:** the emissive light takes the tint (the factor divided by its brightest channel). A coloured light far above white washed out to white in the tone map. Its brightest channel is now capped at 1.2 after exposure, all channels in proportion. White lights are not capped. ## Bulb filament hidden The candle bulb's glass shell (`standard_alpha_inst`) has a colour texture with constant alpha 64. The rule that draws constant-alpha materials opaque was made for ped clothing, and it made the glass opaque too. The rule now skips the forward-alpha shader families from the family table (`standard_alpha`, `standard_alpha_inst`, `standard_alpha_secmo`, `standard_anisotropy_dirt_alpha`). Their alpha is their opacity. Shaders that are alpha only by their render-bucket flags (ped clothing) are still drawn opaque. In the 493 sample models, 23 glass materials went back to BLEND. Two `standard_dirt_alpha` materials keep the rule. ## Checked - Re-exported the 493 samples. GLB strength and tint match model.json in every material, and `extensionsUsed` is right. - Night screenshots: the candle bulb shows its white filament through the glass, the fish sign's tubes are light blue, a building's neon outline is teal and pink, and the glass railings glow blue. - `cargo check --workspace --all-targets` and `cargo test -p sixng-core -p sixng-gui --release` pass. New tests cover the tint (export, factor, invalid values, viewer colour) and the glass families versus bucket-only alpha. The Metal 4 renderer is still 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.
Export: the constant after emissivemultiplier (7ab0fd74, float3, name not
recovered) is the light's colour; it is multiplied into the GLB
emissiveFactor and written as emissive_strength.tint. Neon tubes have their
colour there over a white emissive map.

The constant-alpha rule (ped clothing drawn opaque) no longer applies to the
forward-alpha shader families: bulb glass and glazing keep their alpha as
opacity, so a bulb's lit filament shows through its glass.

Viewer: emissive light takes the tint; a coloured light's brightest channel
is capped so the tone map does not wash it to white.
# 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
# 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:23:36 +00:00
github manually merged commit 6d487a391d into gh-pr/274/base 2026-11-26 20:23:37 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.