Repository navigation
A material can choose its own lights on the Wasm engine (lightsNode) - #618
Merged
Merged
Conversation
…the owned engine
three's `material.lightsNode = lights([cabin])` refused on the Wasm engine with
TN_NATIVE_UNCATALOGUED_LIGHTS, so a camera-parented cockpit could not light its
interior with its own cabin lamp while the sun stayed off it (Starlance friction,
2026-11-05).
- `lights([...])` crosses as one engine object per light (browser and V8 bridges)
and builds a `lights` node; `lightsNode` is bound on every node material.
- The renderer marks each direct light a lightsNode leaves out as excluded in the
program's light layout ('-'), keys the program on the listed ids, and writes only
the listed ambient and hemisphere terms into that program's frame slab.
- Conformance row `material-lights`: the Wasm engine matches upstream three
(pixelMismatchRatio 0, deltaE 0); develop fails it with the original refusal.
…n the native core tests
abi_test: lights([...]) keeps one engine object per light in order and refuses a non-light.
material_test: a layout with an excluded light ('-') declares no uniforms for it (standard,
physical, lambert, phong); red without the shader skip, green with it. native-engine ctest 247/247.
Contributor
|
The merge queue stopped on
Fix, push, re-enqueue. |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 6, 2026
Contributor
Author
|
Merge-group run 42153247173 went red on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR about?
three.js lets a material sum only the lights it lists:
material.lightsNode = lights([cabin]). The owned Wasm engine refused it (TN_NATIVE_UNCATALOGUED_LIGHTS: lights is not available on the Wasm engine.) and the scene aborted. This PR makes it work on the owned engine (Wasm on web, and the shared C++ the V8 desktop player runs).Why does it matter?
Starlance (sandbox friction log, 2026-11-05) needs to light a camera-parented cockpit with its own cabin lamp. The sun reached the interior unshadowed and blew near-black materials to cream, so the game shipped a metalness hack instead. With this PR the game writes the portable three.js line and the sun stays off the interior.
What changed
lights([...])crosses as one engine object per light (browser bridge and V8 bridge), andlightsNodeis bound on every node material (catalog, registry, generated types).material-lights: blue sun, ambient, warm cabin lamp parented to the camera; right knot and dashboard panel uselights([cabin]).Proof
TN_NATIVE_UNCATALOGUED_LIGHTS(the friction). Green: the row passes; Wasm capture vs upstream three.jspixelMismatchRatio 0,perceptualDeltaE 0(2 runs per arm, headed Chromium WebGPU, adapter nvidia/turing).__tnWebThreads"on (8)", 35 MB Wasm heap, 396 crossings).browser-tsl.spec.tstest; three-native 491/491; conformance runner 90/90; registry/CI script specs 28/28; starter-post bundle 11/11; lint pass.native-enginerecipe, local):ctest -L native-engine247/247, incl. the registry snapshot and new red-green cases inabi_test(lights marshalling) andmaterial_test(excluded light declares nothing).pnpm budgetswith a re-measured native coverage record.v8_adapter_testneeds the V8 player build); the merge queue's full board runs it.