fix(sky): keep the Milky Way out of model lighting, test the sky wiring

Scene reads skyBox._cubeMap as the environment map that lights models, in
the TEME, flipY layout of Cesium's own sky box; the ICRF Milky Way would
light them rotated. Rename the field so models keep Cesium's default.

Test the anime fade on a real StarrySky and that the viewer gets the sky
as an option (skyBox: false would drop the Sun and Moon). Correct three
comments on the star limit and the Milky Way levels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
German KhokhlovandClaude Opus 5.5 committed 2026-10-20 13:37:43 +04:00
1 parent 86ae5e9cf4
commit d94cc35c81
7 files changed
+54 -17

No files matched your search

+7 -4
View File
@@ -180,7 +180,10 @@ export class StarrySky {
this._loading = false;
this._starData = undefined;
this._faceImages = undefined;
this._cubeMap = undefined;
// Not `_cubeMap`: Scene reads `skyBox._cubeMap` as the environment map
// that lights models, in the TEME, flipY layout of its own sky box. This
// ICRF map would light them rotated, so models keep Cesium's default.
this._milkyWayCubeMap = undefined;
this._milkyWayCommand = undefined;
this._milkyWayAttributes = undefined;
this._starCommand = undefined;
@@ -191,7 +194,7 @@ export class StarrySky {
};
this._milkyWayUniforms = {
...uniforms,
u_milkyWay: () => this._cubeMap,
u_milkyWay: () => this._milkyWayCubeMap,
u_intensity: () => this.milkyWayIntensity * this.milkyWayVisibility,
};
this._starUniforms = {
@@ -301,7 +304,7 @@ export class StarrySky {
cubeMap.sampler = new Cesium.Sampler({
minificationFilter: Cesium.TextureMinificationFilter.LINEAR_MIPMAP_LINEAR,
});
this._cubeMap = cubeMap;
this._milkyWayCubeMap = cubeMap;
this._faceImages = undefined;
const geometry = Cesium.BoxGeometry.createGeometry(
Cesium.BoxGeometry.fromDimensions({
@@ -440,7 +443,7 @@ export class StarrySky {
command.vertexArray?.destroy();
command.shaderProgram?.destroy();
}
this._cubeMap = this._cubeMap?.destroy();
this._milkyWayCubeMap = this._milkyWayCubeMap?.destroy();
this._milkyWayCommand = undefined;
this._starCommand = undefined;
this._commands.length = 0;
+8
View File
@@ -127,3 +127,11 @@ test('the Milky Way glow scales with its visibility, for styles that hide it', (
assert.equal(sky._milkyWayUniforms.u_intensity(), 0);
sky.destroy();
});
test('the Milky Way stays out of the environment map that lights models', () => {
// Scene#render hands `skyBox._cubeMap` to image-based lighting, which
// expects Cesium's own TEME, flipY layout; this ICRF map would be rotated.
const sky = new StarrySky({ requestRender: () => {} });
assert.equal('_cubeMap' in sky, false);
sky.destroy();
});
+1 -1
View File
@@ -13,7 +13,7 @@
* @module sky/stars
*/
/** Faintest catalogue magnitude; also the reference for brightness. */
/** Faintest magnitude drawn distinctly (fainter catalogue stars look like it); the brightness reference. */
export const STAR_LIMIT_MAGNITUDE = 6.5;
/** Gaussian σ of the faintest star, CSS pixels. */
export const STAR_MIN_SIGMA_PX = 0.55;