code wiki / (root) / nx_gsplat.nx

nx_gsplat.nx

buildroot/runtime/nx_gsplat.nx

52043 B895 linesdepth 2pulls 4 transitivereach 20 importersview sourcekind librarytopic gsplat
docsdependenciesstructsconstsfunctions

about

nx_gsplat.nx -- ★SOVEREIGN 3D GAUSSIAN SPLATTING (the frontier rendering rep for photoreal avatars, confirmed #1 by the 2024-2025 SOTA scan: GaussianAvatars/VRGaussianAvatar/HumanSplat all use it). A scene = a cloud of 3D Gaussians {position, scale(σ), colour, opacity}; render = PROJECT each to a 2D splat, DEPTH-SORT, and FRONT-TO-BACK alpha-composite. ALL INTEGER (fx1024 positions, fx256 opacity/transmittance, an integer exp-LUT for the Gaussian falloff), deterministic, VM-vettable. ★The RENDERER needs NO trained weights (only a generator would) -- so it is fully sovereign-buildable TODAY. v0 = ISOTROPIC Gaussians (spherical σ -> a circular screen splat); anisotropic 3D covariance (the Jacobian projection) + SH view-dependent colour are the next rungs. Camera convention MATCHES nx_sdfrender (yaw orbit, FOCAL 586) so splats align with our SDF/mesh. license_tier: ORIGINAL

dependencies 3 imports · 20 importers

nx_syscalls.nx nx_itrig.nx nx_vecmath.nx nx_gsplat.nx nx_avatar_splat.nx nx_gsplat4d_gate.nx nx_gsplat4d_lib.nx nx_gsplat_aniso_gate.nx nx_gsplat_density.nx nx_gsplat_density_gate.nx nx_gsplat_elara_gate.nx nx_gsplat_face_gate.nx nx_gsplat_fit_aniso_gate.nx nx_gsplat_fit_gate.nx

diagram shows first 10 each side; +0 more imports, +10 more importers in the complete lists below.

imports: nx_syscalls.nxnx_itrig.nxnx_vecmath.nx

imported by: nx_avatar_splat.nxnx_gsplat4d_gate.nxnx_gsplat4d_lib.nxnx_gsplat_aniso_gate.nxnx_gsplat_density.nxnx_gsplat_density_gate.nxnx_gsplat_elara_gate.nxnx_gsplat_face_gate.nxnx_gsplat_fit_aniso_gate.nxnx_gsplat_fit_gate.nxnx_gsplat_frommesh_gate.nxnx_gsplat_gate.nxnx_gsplat_optimize_gate.nxnx_gsplat_perf.nxnx_gsplat_photofit_gate.nxnx_gsplat_res_gate.nxnx_gsplat_showcase.nxnx_gsplat_tile_gate.nxnx_gsplat_tile_lib.nxnx_persongen_render_gate.nx

structs

none

consts

13const K_MAGIC_4096: i64 = 4096
14const K_MAGIC_3970: i64 = 3970
15const K_MAGIC_2000000000: i64 = 2000000000
16const K_MAGIC_65536: i64 = 65536
17const K_MAGIC_999999: i64 = 999999
19const GW: i64 = 512
20const GH: i64 = 384
21const GHW: i64 = 256
22const GHH: i64 = 192
23const GFOCAL: i64 = 586
24const GFX: i64 = 1024 // model-unit fixed point (matches sdf)
25const GEXPN: i64 = 176 // exp-LUT entries: k=0..175 -> u=k/16 in [0,11) (11σ² = past 3σ)
26const GNB: i64 = 2048 // depth-sort buckets
32const GFXA: i64 = 256 // opacity / normal / transmittance fixed point
33const GLUTU: i64 = 16 // exp-LUT sub-steps per unit of u: explut[k] = GFXA*exp(-k/(2*GLUTU))
34const GSTA: i64 = 12 // stride of the ANISOTROPIC record gs_render_aniso consumes
35const GSTI: i64 = 8 // stride of the ISOTROPIC record gs_render consumes
227const GNEARZ: i64 = 64 // near-clip in camera depth units: nearer than this is culled
228const GUPTHRESH: i64 = 210 // |n.y| (fx256) above which the up-vector must be swapped to avoid
230const GSIGMA_CUT: i64 = 3 // AABB half-extent in sigma; the LUT carries weight to sqrt(GEXPN/GLUTU)
821const GTRI_VS: i64 = 6 // per-vertex stride inside a triangle record: x y z r g b
822const GTRI_STRIDE: i64 = 18 // 3 * GTRI_VS -- the whole triangle record
823const GTRI_CO: i64 = 3 // colour offset inside one vertex record
824const GFM_HALF: i64 = 2 // the cross-product magnitude is TWICE the triangle area
825const GFM_MIN_SIDE: i64 = 1 // a face never vanishes: every triangle yields at least one surfel
826const GFM_MIN_RTAN: i64 = 1 // a zero-radius surfel would render as nothing at all
827const GFM_STATS: i64 = 4 // slots the caller must provide
828const GFM_ST_VISITED: i64 = 0
829const GFM_ST_TRUNC: i64 = 1
830const GFM_ST_WANT: i64 = 2
831const GFM_ST_CLAMP: i64 = 3

functions

38func gs_fx() -> i64 { return GFX }
called by 3: mainmainmain
39func gs_fxa() -> i64 { return GFXA }
40func gs_lutu() -> i64 { return GLUTU }
41func gs_stride_aniso() -> i64 { return GSTA }
42func gs_stride_iso() -> i64 { return GSTI }
46func gs_isqrt(v: i64) -> i64 { return vm_isqrt(v) }
50func gs_build_explut(explut: *i64) -> i64
62func gs_clear_at(acc: *i64, trans: *i64, npx: i64) -> i64
67func gs_clear(acc: *i64, trans: *i64) -> i64 { return gs_clear_at(acc, trans, GW * GH) }
called by 1: gs_render calls 1: gs_clear_at
72func gs_render(gauss: *i64, ng: i64, yaw: i64, camz: i64, fb: *i64, acc: *i64, trans: *i64, depth: *i64, sxb: *i64, syb: *i64, sigb: *i64, order: *i64, count: *i64, explut: *i64, bgr: i64, bgg: i64, bgb: i64) -> i64
175func gs_set(gauss: *i64, i: i64, x: i64, y: i64, z: i64, sc: i64, r: i64, g: i64, b: i64, op: i64) -> i64
184func gs_set_aniso(gauss: *i64, i: i64, x: i64, y: i64, z: i64, nx: i64, ny: i64, nz: i64, rtan: i64, r: i64, g: i64, b: i64, op: i64) -> i64
206func gs_focal_for(h: i64) -> i64 { return GFOCAL * h / GH }
207func gs_proj_x_at(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64, hw: i64, focal: i64) -> i64
213func gs_proj_y_at(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64, hh: i64, focal: i64) -> i64
218func gs_proj_x(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64) -> i64
calls 1: gs_proj_x_at
221func gs_proj_y(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64) -> i64
calls 1: gs_proj_y_at
234func gs_project_sort_at(gauss: *i64, ng: i64, yaw: i64, camz: i64, depth: *i64, sxb: *i64, syb: *i64, pa: *i64, pb: *i64, pc: *i64, pdet: *i64, order: *i64, count: *i64, hw: i64, hh: i64, focal: i64) -> i64
308func gs_project_sort(gauss: *i64, ng: i64, yaw: i64, camz: i64, depth: *i64, sxb: *i64, syb: *i64, pa: *i64, pb: *i64, pc: *i64, pdet: *i64, order: *i64, count: *i64) -> i64
313func gs_splat_rx(ca: i64) -> i64 { return GSIGMA_CUT * gs_isqrt(ca) }
314func gs_splat_ry(cc: i64) -> i64 { return GSIGMA_CUT * gs_isqrt(cc) }
323func gs_blend_rect(gauss: *i64, g: i64, sx: i64, sy: i64, ca: i64, cb: i64, cc: i64, det: i64, x0: i64, x1: i64, y0: i64, y1: i64, acc: *i64, trans: *i64, explut: *i64, stride_w: i64, satcnt: *i64) -> i64
361func gs_resolve(fb: *i64, acc: *i64, trans: *i64, npx: i64, bgr: i64, bgg: i64, bgb: i64) -> i64
379func gs_render_aniso_at(gauss: *i64, ng: i64, yaw: i64, camz: i64, fb: *i64, acc: *i64, trans: *i64, depth: *i64, sxb: *i64, syb: *i64, pa: *i64, pb: *i64, pc: *i64, pdet: *i64, order: *i64, count: *i64, explut: *i64, bgr: i64, bgg: i64, bgb: i64, w: i64, h: i64, focal: i64) -> i64
420func gs_render_aniso(gauss: *i64, ng: i64, yaw: i64, camz: i64, fb: *i64, acc: *i64, trans: *i64, depth: *i64, sxb: *i64, syb: *i64, pa: *i64, pb: *i64, pc: *i64, pdet: *i64, order: *i64, count: *i64, explut: *i64, bgr: i64, bgg: i64, bgb: i64) -> i64
429func gs_color_grad_step(gauss: *i64, ng: i64, target: *i64, yaw: i64, camz: i64, fb: *i64, acc: *i64, trans: *i64, depth: *i64, sxb: *i64, syb: *i64, sigb: *i64, order: *i64, count: *i64, explut: *i64, gradbuf: *i64, wnorm: *i64) -> i64
called by 3: mainmainmain calls 1: gs_render
512func gs_pos_grad_step(gauss: *i64, ng: i64, target: *i64, yaw: i64, camz: i64, fb: *i64, acc: *i64, trans: *i64, depth: *i64, sxb: *i64, syb: *i64, sigb: *i64, order: *i64, count: *i64, explut: *i64, gradbuf: *i64, wnorm: *i64) -> i64
called by 1: main calls 3: gs_renderit_sin4096it_cos4096
642func gs_pos_grad_step_aniso(gauss: *i64, ng: i64, target: *i64, yaw: i64, camz: i64, fb: *i64, acc: *i64, trans: *i64, depth: *i64, sxb: *i64, syb: *i64, pa: *i64, pb: *i64, pc: *i64, pdet: *i64, order: *i64, count: *i64, explut: *i64, gradbuf: *i64, wnorm: *i64, vw: i64, vh: i64, usetrans: i64) -> i64
792func gs_w() -> i64 { return GW }
called by 18: mainmainmainmainmainmain+12
793func gs_h() -> i64 { return GH }
called by 18: mainmainmainmainmainmain+12
794func gs_expn() -> i64 { return GEXPN }
795func gs_nb() -> i64 { return GNB }
called by 16: mainmainmainmainmainmain+10
833func gs_from_mesh(tris: *i64, ntri: i64, gauss: *i64, cap: i64, density: i64, opacity: i64, stats: *i64) -> i64
called by 1: main calls 2: gs_isqrtgs_set_aniso
894func gs_tri_stride() -> i64 { return GTRI_STRIDE }
called by 1: main
895func gs_fm_stats() -> i64 { return GFM_STATS }
called by 1: main