Skip to content

packaging: find lights below glTF orientation helpers after a runtime load - #646

Merged
freezy merged 2 commits into
masterfrom
fix/insert-spill-light
Nov 25, 2026
Merged

freezy merged 2 commits into
masterfrom
fix/insert-spill-light

Conversation

@freezy

@freezy freezy commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

In the player, tables loaded from a .vpe lost track of lights that glTFast moves onto its orientation helpers. Two symptoms, one cause.

1. Insert spill lights stayed lit

Every insert's spill light stayed lit at its exported intensity, whatever the lamp did. The insert shader went dark, but the spot under it kept lighting the plastics.

glTF spots point the other way than Unity's, so glTFast puts a spot on a rotated <name>_Orientation child: once when exporting, and again when instantiating. At runtime the light sits two helpers below the node the spill reference names. InsertLightPackable.UnpackReferences resolved it with GetComponent<Light>() on that node, got null, and the insert never drove its spill. The light kept the state meta/lights.json gave it: enabled, at the authored intensity.

Fix: VpeLightRestore.FindLight returns the node's own light, or follows the helpers named after their parent down to it. The spill reference resolves through it.

2. A lamp's lights could take each other's settings

A LightComponent packs its light sources with sibling-index paths. At runtime those paths land on the wrong lights: glTFast prepends its helper to a spot's node's children, and the export skips inactive objects (such as a hidden bulb mesh) that the paths still count. On a lamp with a spot and point lights below it, a point light could get another light's settings, a spot's type included.

Fix: the runtime reader now applies the lights payload (meta/lights.json, every exported light by stable node id) after the items, so the path-based restore no longer has the last word. The editor import already used this order.

Package compatibility

Only reading changed, not the format: no items schema bump. Existing .vpe files load correctly with this build.

Tests

  • SpillReferenceFindsTheSpotBelowGltfOrientationHelpers: the spot two helpers down is found, and an authored light named like a helper isn't taken for one.
  • PackagedInsertUsesGlbMeshAndRestoresLampInRuntimeReader now exports a spot spill and loads it through RuntimePackageReader. The spill's own node has no light, and the reference still resolves to the spot.
  • LampLightSourcesKeepTheirSettingsBesideASpot: a lamp with a spot, point A, spot B, point C and a hidden bulb, through PackageWriter + RuntimePackageReader. Every light keeps its own type and range. With the old order it fails: A loads as a spot with B's range.
  • All packaging tests pass in the HDRP test project (133 passed, 1 skipped because symbolic links aren't available).

A table loaded from a .vpe in the player left every insert's spill light
lit at its exported intensity, whatever the lamp did: the insert went dark,
the spot under it kept lighting the plastics.

glTF spots point the other way than Unity's, so glTFast puts them on a
rotated <name>_Orientation child, once when exporting and again when
instantiating. The spill reference resolved with GetComponent<Light>() on
the node its id names, which at runtime holds no light, so the insert never
drove it. The editor import folds the helpers back into the prefab's light,
which is why only the player was affected.

VpeLightRestore.FindLight follows the helpers named after their parent down
to the light. No package format change: existing .vpe files load correctly.
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Restores insert spill references through glTFast’s orientation helpers.

  • Insert spills find spot lights beneath glTF orientation helpers.
  • Runtime loads restore saved settings for each lamp light.

Reviews (2) · Last reviewed commit: "packaging: restore the lights payload af..." · Reviewed by Greptile

A lamp's light sources are packed with sibling-index paths. At runtime those
paths land on the wrong lights: glTFast puts a spot or directional light on
rotated <name>_Orientation helpers that it prepends to the node's children,
and the export skips inactive objects that the paths still count. A lamp with
a spot and point lights below it then gave a point light another light's
settings, a spot's included.

The lights payload (meta/lights.json) holds every exported light by node id.
The runtime reader applied it before the items and let the path-based restore
override it; it now applies it after them, as the editor import already does.
@freezy freezy changed the title insert: find the spill light below glTF orientation helpers Find lights below glTF orientation helpers after a runtime load Nov 25, 2026
@freezy freezy changed the title Find lights below glTF orientation helpers after a runtime load packaging: find lights below glTF orientation helpers after a runtime load Nov 25, 2026
@freezy
freezy merged commit 4ee3ab2 into master Nov 25, 2026
15 checks passed
@freezy
freezy deleted the fix/insert-spill-light branch November 25, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant