import { type ImpostorFraming } from './impostor'; /** * `gbuffer/1`: the impostor holds what the item's materials ARE (albedo, normal, roughness, metalness, glow, clear coat), not how a neutral rig * lit them. The runtime lights it with the same three.js physical material and the same lights as the full model (the sun, hemisphere and ambient * lights, the environment, the probe grid), so a placed item has the right brightness and hue at every heading and time of day without a fitted * constant. The frames are on the `hemi-oct/1` layout. The atlas is three KTX2 files of 8 x 8 views of IMPOSTOR_SIZE / 8 px: * * - albedo: sRGB RGB albedo, A = coverage (this is also what an albedo-only reader would draw). * - surface: linear, R and G = the view-space normal's x and y (z is rebuilt: a visible surface faces the camera), B = roughness, A = metalness. * - emissive: sRGB RGB = emissive radiance x GBUFFER_EMISSIVE_SCALE, A = clear coat strength. Present only when the item glows or has a clear coat. */ export declare const GBUFFER_SHADING: "gbuffer/1"; export declare const GBUFFER_LAYOUT: "hemi-oct/1"; /** The emissive map stores radiance at this fraction (8-bit headroom); the runtime multiplies it back. */ export declare const GBUFFER_EMISSIVE_SCALE = 0.25; /** * The impostor is left out of a `gbuffer/1` artifact only for an item that is both tiny (at most this many triangles: its instanced model costs * less to draw than a billboard costs to fetch) and whose three maps cost at least GBUFFER_BYTES_SLACK times its source's bytes. Anything bigger * keeps its impostor whatever its bytes: far placements of it are drawn as two triangles instead of the model, which is the point of the file. */ export declare const GBUFFER_MIN_TRIANGLES = 300; export declare const GBUFFER_BYTES_SLACK = 2; export type Vec3 = [number, number, number]; /** * The direction of frame (i, j) on `hemi-oct/1`: the upper hemisphere folded into the octahedral diamond, the diamond turned 45 degrees onto * the 8 x 8 grid so that the grid's outer ring IS the horizon. (u, v) = (2i/(n-1) - 1, 2j/(n-1) - 1); x = (u + v) / 2, z = (u - v) / 2, * y = 1 - |x| - |z|, normalised. The 28 frames of the outer ring look along the horizon, 9.5 to 16.2 degrees apart in azimuth; none looks from below * the ground a prop stands on, and a player at ground level, who sees every far item from within a few degrees of the horizon, sits ON the ring. */ export declare function hemiOctDirection(i: number, j: number, views?: number): Vec3; /** The four capture passes, each RGBA with the view cell layout of the atlas, bottom row first, alpha = coverage. */ export interface GBufferPasses { /** sRGB albedo. */ albedo: Uint8Array; /** Linear view-space normal x, y, z mapped to 0..1 (camera space of the view: x right, y up, z toward the viewer). */ normal: Uint8Array; /** Linear roughness, metalness, clear coat. */ material: Uint8Array; /** sRGB emissive radiance x GBUFFER_EMISSIVE_SCALE. */ emissive: Uint8Array; } export interface GBufferAtlases { albedo: Uint8Array; surface: Uint8Array; /** Null when no texel glows and none has a clear coat. */ emissive: Uint8Array | null; /** True when the emissive map's alpha carries a clear coat. */ clearcoat: boolean; emissiveTexels: number; coatTexels: number; } /** * Dilates `channels` of `data` into texels `coverage` leaves empty, inside each view cell, so filtering at a silhouette never mixes in black. * Same step count and neighbour order as `dilateImpostorColors`, but the occupancy comes from a separate mask because only the albedo map's alpha is coverage. */ export declare function dilateWithMask(data: Uint8Array, coverage: Uint8Array, size: number, channels: readonly number[], steps?: number): Uint8Array; /** Packs the four capture passes into the three maps and dilates each into the empty texels of its view cell. */ export declare function packGBuffer(passes: GBufferPasses, size?: number): GBufferAtlases; /** The four G-buffer passes of an item on `hemi-oct/1`, from a capture GLB (static, single-material primitives), in the shared headless capture host. */ export declare function captureGBufferPasses(captureGlb: Uint8Array, framing: ImpostorFraming, size?: number): Promise; export interface EncodedGBuffer { albedo: Uint8Array; surface: Uint8Array; emissive: Uint8Array | null; } /** UASTC KTX2 with mips for each map: albedo and the emissive map as sRGB colour, the surface map as linear data. */ export declare function encodeGBufferAtlases(atlases: GBufferAtlases, size?: number): Promise; /** A top-row-first PNG of the albedo atlas and, for review, the surface map's normal as RGB over its own coverage; never part of the artifact. */ export declare function gbufferPreviewPng(atlases: GBufferAtlases, size?: number): Promise<{ albedo: Uint8Array; surface: Uint8Array; }>;