nx_gsplat.nx
buildroot/runtime/nx_gsplat.nx
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
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
| 13 | const K_MAGIC_4096: i64 = 4096 |
| 14 | const K_MAGIC_3970: i64 = 3970 |
| 15 | const K_MAGIC_2000000000: i64 = 2000000000 |
| 16 | const K_MAGIC_65536: i64 = 65536 |
| 17 | const K_MAGIC_999999: i64 = 999999 |
| 19 | const GW: i64 = 512 |
| 20 | const GH: i64 = 384 |
| 21 | const GHW: i64 = 256 |
| 22 | const GHH: i64 = 192 |
| 23 | const GFOCAL: i64 = 586 |
| 24 | const GFX: i64 = 1024 // model-unit fixed point (matches sdf) |
| 25 | const GEXPN: i64 = 176 // exp-LUT entries: k=0..175 -> u=k/16 in [0,11) (11σ² = past 3σ) |
| 26 | const GNB: i64 = 2048 // depth-sort buckets |
| 32 | const GFXA: i64 = 256 // opacity / normal / transmittance fixed point |
| 33 | const GLUTU: i64 = 16 // exp-LUT sub-steps per unit of u: explut[k] = GFXA*exp(-k/(2*GLUTU)) |
| 34 | const GSTA: i64 = 12 // stride of the ANISOTROPIC record gs_render_aniso consumes |
| 35 | const GSTI: i64 = 8 // stride of the ISOTROPIC record gs_render consumes |
| 227 | const GNEARZ: i64 = 64 // near-clip in camera depth units: nearer than this is culled |
| 228 | const GUPTHRESH: i64 = 210 // |n.y| (fx256) above which the up-vector must be swapped to avoid |
| 230 | const GSIGMA_CUT: i64 = 3 // AABB half-extent in sigma; the LUT carries weight to sqrt(GEXPN/GLUTU) |
| 821 | const GTRI_VS: i64 = 6 // per-vertex stride inside a triangle record: x y z r g b |
| 822 | const GTRI_STRIDE: i64 = 18 // 3 * GTRI_VS -- the whole triangle record |
| 823 | const GTRI_CO: i64 = 3 // colour offset inside one vertex record |
| 824 | const GFM_HALF: i64 = 2 // the cross-product magnitude is TWICE the triangle area |
| 825 | const GFM_MIN_SIDE: i64 = 1 // a face never vanishes: every triangle yields at least one surfel |
| 826 | const GFM_MIN_RTAN: i64 = 1 // a zero-radius surfel would render as nothing at all |
| 827 | const GFM_STATS: i64 = 4 // slots the caller must provide |
| 828 | const GFM_ST_VISITED: i64 = 0 |
| 829 | const GFM_ST_TRUNC: i64 = 1 |
| 830 | const GFM_ST_WANT: i64 = 2 |
| 831 | const GFM_ST_CLAMP: i64 = 3 |
functions
| 38 | func gs_fx() -> i64 { return GFX } |
| 39 | func gs_fxa() -> i64 { return GFXA } |
| 40 | func gs_lutu() -> i64 { return GLUTU } |
| 41 | func gs_stride_aniso() -> i64 { return GSTA } |
| 42 | func gs_stride_iso() -> i64 { return GSTI } |
| 46 | func gs_isqrt(v: i64) -> i64 { return vm_isqrt(v) } called by 10: maings_project_sort_atgs_splat_rxgs_splat_rygs_from_meshg4_horizon_sigma+4 calls 1: vm_isqrt |
| 50 | func gs_build_explut(explut: *i64) -> i64 |
| 62 | func gs_clear_at(acc: *i64, trans: *i64, npx: i64) -> i64 |
| 67 | func gs_clear(acc: *i64, trans: *i64) -> i64 { return gs_clear_at(acc, trans, GW * GH) } |
| 72 | func 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 called by 8: gs_color_grad_stepgs_pos_grad_stepmainmainmainmain+2 calls 3: it_sin4096it_cos4096gs_clear |
| 175 | func gs_set(gauss: *i64, i: i64, x: i64, y: i64, z: i64, sc: i64, r: i64, g: i64, b: i64, op: i64) -> i64 |
| 184 | func 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 |
| 206 | func gs_focal_for(h: i64) -> i64 { return GFOCAL * h / GH } |
| 207 | func gs_proj_x_at(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64, hw: i64, focal: i64) -> i64 |
| 213 | func gs_proj_y_at(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64, hh: i64, focal: i64) -> i64 |
| 218 | func gs_proj_x(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64) -> i64 calls 1: gs_proj_x_at |
| 221 | func gs_proj_y(x: i64, y: i64, z: i64, sy4: i64, cy4: i64, R: i64) -> i64 calls 1: gs_proj_y_at |
| 234 | func 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 |
| 308 | func 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 calls 1: gs_project_sort_at |
| 313 | func gs_splat_rx(ca: i64) -> i64 { return GSIGMA_CUT * gs_isqrt(ca) } called by 10: gs_render_aniso_atgs_pos_grad_step_anisogd_meansgd_classifymainmain+4 calls 1: gs_isqrt |
| 314 | func gs_splat_ry(cc: i64) -> i64 { return GSIGMA_CUT * gs_isqrt(cc) } called by 8: gs_render_aniso_atgs_pos_grad_step_anisogd_meansgd_classifymaintg_fullscreen_evals+2 calls 1: gs_isqrt |
| 323 | func 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 |
| 361 | func gs_resolve(fb: *i64, acc: *i64, trans: *i64, npx: i64, bgr: i64, bgg: i64, bgb: i64) -> i64 |
| 379 | func 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 |
| 420 | func 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 |
| 429 | func 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 |
| 512 | func 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 |
| 642 | func 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 called by 2: mainmain calls 6: gs_focal_forgs_render_aniso_atit_sin4096it_cos4096gs_splat_rxgs_splat_ry |
| 792 | func gs_w() -> i64 { return GW } |
| 793 | func gs_h() -> i64 { return GH } |
| 794 | func gs_expn() -> i64 { return GEXPN } |
| 795 | func gs_nb() -> i64 { return GNB } |
| 833 | func gs_from_mesh(tris: *i64, ntri: i64, gauss: *i64, cap: i64, density: i64, opacity: i64, stats: *i64) -> i64 |
| 894 | func gs_tri_stride() -> i64 { return GTRI_STRIDE } called by 1: main |
| 895 | func gs_fm_stats() -> i64 { return GFM_STATS } called by 1: main |