/** * @fileoverview GaussianSH — the spherical-harmonics (view-dependent) color model for the native * 3DGS trainer. Closes the /critic #4 gap ("flat RGB, cannot fit view-dependent / specular color"). * * Real 3DGS encodes each gaussian's color as SH coefficients (the inria default is degree 3). The * color seen from a view direction d is C(d) = 0.5 + Σ_k basis_k(d)·coeff_k — so the same gaussian * looks different from different angles (specular highlights, sheen). Flat RGB is exactly SH degree 0 * with no directional terms, which can only reproduce the angular AVERAGE. * * This module is the gradient-checked SH color FUNCTION (forward + backward, degrees 0-2). It is the * piece a SH-aware runner uses as the per-view color: forward3D's flat `r,gr,bl` would be replaced by * `0.5 + evalSH(coeffs, viewdir)` per view, and the existing dL/d{r,gr,bl} chained back to dL/dcoeffs * (and dL/dviewdir → dL/dmean3d) via evalSHGrad. The model + its view-dependence are verified here; * threading it through the full 3D training loop is the documented integration step. */ /** Real-SH basis constants (match the inria 3DGS / gsplat convention). */ export declare const SH_C0 = 0.28209479177387814; export declare const SH_C1 = 0.4886025119029199; export declare const SH_C2: readonly [1.0925484305920792, -1.0925484305920792, 0.31539156525252005, -1.0925484305920792, 0.5462742152960396]; /** Number of SH coefficients per color channel for a given degree: (deg+1)^2. */ export declare function shCoeffCount(deg: number): number; /** SH basis values at a (normalized) direction (x,y,z), length (deg+1)^2. */ export declare function shBasis(x: number, y: number, z: number, deg: number): number[]; /** Single-channel SH radiance Σ basis_k·coeff_k (the caller adds the 0.5 offset for final color). */ export declare function evalSH(coeffs: ArrayLike, x: number, y: number, z: number, deg: number): number; export interface SHGrad { /** dRadiance/dcoeff_k, length (deg+1)^2. */ dCoeffs: number[]; /** dRadiance/d(x,y,z) — the view-direction gradient (for the mean3d chain). */ dDir: [number, number, number]; } /** * Backward of evalSH. Given the upstream dRadiance (= dL/dcolor), returns dL/dcoeffs and dL/ddir. * Verified against central finite differences in GaussianSH.test.ts. */ export declare function evalSHGrad(coeffs: ArrayLike, x: number, y: number, z: number, deg: number, dR: number): SHGrad; /** Convenience: SH color (0.5 + radiance, clamped to [0,1]) for one channel at a view direction. */ export declare function shColor(coeffs: ArrayLike, x: number, y: number, z: number, deg: number): number; //# sourceMappingURL=GaussianSH.d.ts.map