import { Document, type Texture } from '@gltf-transform/core'; /** * Highest sRGB channel value (0-255) an emissive map may reach and still count as BLACK. Meshy's rigged exports ship a * flat near-black emissive image (measured max 4 and 12 on two 2048px maps, mean 0.0) beside emissiveFactor [1,1,1]; a * genuinely authored mask (glowing eyes, screens, trim) has real bright texels, so its max is far above this. 24 is * linear 0.009 - invisible even as pure additive light - and leaves a wide margin over the measured Meshy noise. */ export declare const BLACK_EMISSIVE_MAX_CHANNEL = 24; /** * True when every texel's RGB is at or below {@link BLACK_EMISSIVE_MAX_CHANNEL}. Returns false (keep the map) when the * image cannot be decoded: an unreadable emissive map is not evidence that it is black. */ export declare function isBlackEmissiveImage(image: Uint8Array | null): Promise; /** Decoded-black memo so the same texture is only decoded once per document pass. */ export declare function isBlackEmissiveTexture(texture: Texture, cache?: Map): Promise; export interface SanitizeMaterialsResult { /** materials whose baked self-illumination was removed (albedo-in-emissive plus black-emissive-map materials) */ emissiveStripped: number; /** of those, materials whose emissive map was a flat black image (Meshy) that paired with a [1,1,1] factor */ blackEmissiveStripped: number; /** of those, materials whose textureless metallic=1 default was dropped to 0 */ metallicZeroed: number; /** untrusted creator metadata discarded before publication */ metadataStripped: number; } /** * Meshy exports bake the albedo into the EMISSIVE channel (the same texture as baseColor, factor * [1,1,1]) so previews pop without any lighting — in-world the character self-glows at full * brightness and a moody scene can't touch it. Strip emissive ONLY on that signature (an authored * emissive mask is a distinct texture and survives), and on those materials drop the textureless * metallic=1 Blender default to 0 — with the glow gone it would render as black chrome under * punctual lights, when the baked look is plain rough albedo. * * The other Meshy shape is a flat BLACK emissive map next to emissiveFactor [1,1,1] (Dreamer jobs 6d294f4f/ed1472df, * 2026-10-03). Black x 1 is no light at all, so it renders correctly until a later stage drops the map and keeps the * factor, which turns the whole avatar flat white. A black map contributes nothing, so both halves go: the texture and * the factor, in the same step. The rule everywhere in the importer is that an emissiveFactor never outlives its map. */ export declare function sanitizeBakedEmissive(document: Document): Promise;