Fix: Fade glowing camouflage parts with the lights

Unlit `Textured` materials loaded as `MeshBasicMaterial`, so they stayed bright while the lights receded during a camouflage switch (E 100 legendary camouflage).

- `Textured` materials now export as standard materials with the base color texture as emissive and a black base color, so they look the same as before.
- The Tankopedia model fades their emissive intensity with the lighting transition.
- Additive blending applies to these parts again, since they are standard materials.
This commit is contained in:
Mark Greene committed 2026-10-30 17:26:50 +13:00
1 parent c772d47a07
commit c535811c1d
2 files changed
+43 -6

No files matched your search

@@ -14,7 +14,7 @@ import {
} from "@blitzkit/core";
import type { AbstractVFS } from "@blitzkit/core/src/blitzkit/vfs/abstract";
import { Document, Material, Node, NodeIO, Scene } from "@gltf-transform/core";
import { ALL_EXTENSIONS, KHRMaterialsUnlit } from "@gltf-transform/extensions";
import { ALL_EXTENSIONS } from "@gltf-transform/extensions";
import { dedup, prune } from "@gltf-transform/functions";
import type { APIContext } from "astro";
import { isEqual, times } from "lodash-es";
@@ -366,10 +366,11 @@ export async function extractMaterials(
}
if (fxName?.endsWith("/Textured.material")) {
material.setExtension(
"KHR_materials_unlit",
document.createExtension(KHRMaterialsUnlit).createUnlit(),
);
// unlit in game, emissive so the viewer can fade it with the lights
material
.setEmissiveTexture(material.getBaseColorTexture())
.setEmissiveFactor([1, 1, 1])
.setBaseColorFactor([0, 0, 0, 1]);
}
if (textures.miscMap) {